AutoCAD Visual LISP / AutoLISP :: Start Command On Existing Selection Set?

Jan 29, 2012

I'd like to pass and existing set of selection to a command like laylck, which asks for selections after beginning the command. 

It must be possible to do this. Some CUI setup, lisp routine?

View 3 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Modify Existing Selection Set?

Sep 5, 2012

I need the same funcionality as in code below, but without using "command".

The main idea is alowed user to modify Existing Selection Set.

 (defun gt:ss->lst (a:ss / i lst ) ;_ / (setq i 0) (if a:ss (progn (repeat (sslength a:ss) (setq lst (cons (ssname a:ss i) lst) i (1+ i) ) ;_ setq ) ;_ repeat (reverse lst) ) ;_ progn ) ;_ if) ;_ defun gt:ss->lst(defun gt:ss_modify (a:en-lst / ) ;_ / ;;create Selection set (setq ss2 (ssadd)) (foreach f:en a:en-lst (ssadd f:en ss2) ) ;_ foreach ;;Run command and fill with initial content (command "_select" ss2) ;;Alow the user to modify the contents (while (/= (getvar "cmdnames") "") (command pause) ) ;_ while ;;get back the list of enames from modified selection set (setq ss3 (ssget "_P")) (setq ss3-lst (gt:ss->lst ss3))) ;_ defun gt:ss_modify(defun tst:gt:ss_modify ( / ) ;_ / (gt:ss_modify (gt:ss->lst (ssget)))) ;_ defum tst:gt:ss_modify

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Make Selection Set After Break Command

Nov 19, 2011

The following function

(command "_break" ent1 p1 p2)

break a polyline into two separate polylines. How can I get a selection set with two separate polylines?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Annotation Command Set Correct Layer For Duration Of Command

Nov 21, 2010

I am currently writing a series of routines for setting the layers for text, leaders and dimension commands. The end goal is a system where any annotation command sets the correct layer for the duration of the command, then reverts back to the layer that was active before the command.

I have managed to complete all the code, and it appears to be working fine, I just have one question: I have used -layer "m" "Lay_name" etc... for all layer setting commands, rather than any code to see if the layer exists already. In my limited testing this seems to be suitable, nothing that exists on that layer seems to be affected.

I know how to write code to determine if the layer exists already and set the layer instead, but so far it seems unnecessary??

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Remove A Selection Set From A Selection Set

Nov 15, 2013

I've created a lisp that draws the boltholes of a pipe flanges, using the correct number of holes, at the correct diameter at the correct bolt-hole diameter and then rotates.  Everything works seamlessly, when i do just one flange.  But I've discovered that fewuently there will be mulitple times when a user will have to perform the command.

So the idea I had was to do the following:

Select all circles with     (setq CirclesFirst (ssget "X" (list (cons 0 "CIRCLE"))))

Go through the code to create the new circles.

Select all circles with     (setq Circles (ssget "X" (list (cons 0 "CIRCLE"))))

Remove selection set "CirclesFirst" from "Circles".

But what for some reason (command "_.select" Circles "R" CirclesFirst "") does not work.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: End Of One Line Is Start Of Another

Apr 24, 2013

I am having a problem with starts and ends of lines. I have draw two lines, end of first is start of second. The problem is because, (cdr (assoc 11 (entget line1))) and (cdr (assoc 10 (entget line2))), somehow, are not the same,

(= (cdr (assoc 11 (entget line1))) (cdr (assoc 10 (entget line2)))) 

is returning nil, what is so confusing to me is that:

(=(nth 0(cdr (assoc 11 (entget line1)))) (nth 0(cdr (assoc 10 (entget line2)))))

is returning true, the same is for y and z coordinates.

I need to check x y and z coordinates, for this type of problem...

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Pline Start And End Angles

Dec 3, 2012

Is there a function to obtain the start angle and end angle of a pline, i know arcs do.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Start Profile Over From Scratch

Jan 17, 2013

ACAD 2009 on XP

Third party software installed which now causes AutoCAD 2009 to crash when a single key is pressed. We have uninstalled the software, however the editor is still looking for the

Non-existent ARX. This is the problem. What file or registry key declares the list as shown in APPLOAD? I have verified 2009 works in the administrator profile.

We also did a repair and then a reinstall of 2009 to no avail. What steps are needed for AutoCAD to build a profile when a previous profile existed?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Start It With No Drawing Open?

Nov 13, 2001

can you start autocad with no drawing open ?

i would think that some type of script would work or could you change your target on a shortcut?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Write A Lisp Routine That Invoke The Mleader Command

Oct 11, 2012

I'm trying to write a lisp routine that, when I invoke the mleader command, osmode is set to "nearest" & orthomode is set off. I then would like the original settings to be returned.

attached is what I have written so far:-

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Use Existing Arc As Fillet Rad

Mar 21, 2007

I have this routine for using a selected arcs rad value as a new fillet rad. If you like, a "match fillet" routine:

;Fillet Copy
;Copies the Radius of an Existing Fillet or Arc;
(defun C:filletcopy ()
(setvar "cmdecho" 0)
(setq c1 (entsel "
Select Fillet to Copy:"))
(setq c1 (entget (car c1)))
(setq rad (cdr(assoc 40 c1)))
(setvar "filletrad" rad)
(princ "
Select Lines:")
(command ".fillet" pause pause)
)

I use the routine loads but could modify so it would pick up the value of a filleted polyline? As it stands it can only select an individual arc. I would like the routine to be able to pick individual arcs and/or filleted polylines, without exploding first, if possible....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Make Different Start Points For Different Commands

Jun 29, 2013

My first lisp, so bring it hard on me I want to be an expert in autolisp .

My lisp is meant to do the following:

draw a rectangle with ”0” fillet. It can be done either via rectangle command, or pline command. The attached lisp has the variant with the pline-case.

The, I need to draw inside a smaller rectangle, with a fillet value, that is promoted and indicated by the user. The smaller rectangle must be centered inside the bigger one. I thought it was a good idea, to take one insertion-point for the bigger rectangle.

and to calculate a 2-nd insertion-point for the smaller rectangle, via "polar" function.

What I get:

the 2-nd insertion point is put the same as the 1-st one.

I wish to draw the bigger rectangle with one layer "example: Layer 1", and the smaller rectangle with another layer "example: Layer 2".

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Find Start And End Point Of AEC WALL

Jan 29, 2003

Using Lisp or VLisp, how can I find the Start & End Point of an AEC_WALL ent. ?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Start MS Access 2010 In Runtime

Oct 13, 2013

I try to start msaccess in runtime mode, but an .accdr will not start.this is the code try to use, without /runtime in the code the .mdb and .accdb works great

(startapp "C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE" /runtime path)

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Redefine Existing Block

Jan 29, 2012

I am using the following function to create a block:

(defun crea-blocco (ip blockname gruppoogg / blkobj sArray c r vla-objects doc) (setq c -1) (repeat (sslength gruppoogg) (setq r (cons (ssname gruppoogg (setq c (1+ c))) r)) ) (setq r (reverse r)) (setq vla-objects (mapcar 'vlax-ename->vla-object r)) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq blkobj (vla-add (vla-get-blocks doc) (vlax-3d-point ip) blockname)) (setq sArray (vlax-safearray-fill (vlax-make-safearray vlax-vbObject (cons 0 (1- (length vla-objects)))) vla-objects)) (vla-copyobjects doc sArray blkobj) blkobj)
 
But if I start this function two times with the same block name, I get a block with the selected objects added to the existing block.

How can I redefine an existing block with vlisp?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Override Existing Commands

Mar 19, 2012

Any way to override existing AutoCAD commands.

Lets try this.  When a user types "line" at the command prompt, or hits the "line" button on the toolbar, or chooses "line" from the draw pulldown menu, is there any way I can re-write what line means and draw a circle?  (Extreme example)

There are just some commands that I'd like to have a variable set in the background, depending on what the command is.  So I'm thinking if I could re-write the "line" command, instead of trying to convince everyone to use and remember a custom command, it would be much more efficient.  There are lisp files already loaded in their start-up suite.  Not sure if that works.

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: True Coordinates Start And End Of Layout Page

Mar 28, 2012

I’m trying to create a view port, which covers my entire layout (white/ page area) using the following command
 
(command “mview” ‘(0 0 0) ‘(297.5 210 0))

However as you will note 0,0,0 is not the very edge corner of my layout (white area) and my white area is smaller then 297.5x 210mm (standard A4 landscape size)

How to obtain the exact measurements and starting coordinates to fully fill my entire layout page (white area)?

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Search For Existing MLeader With Attribute Value

May 21, 2013

I'm working out a LISP for searching my entire drawing for a MLeader with a given value and then do something if it is found.

Currently, my code dies with 

; error: Automation Error. Description was not provided.

I do not know what is going wrong & I don't know what must be done next.
 
(DEFUN ML-SRCHSTR (TXT LBL / SS n_txt_LBL ENT P1 P2) ;|(ML-SRCHSTR TXT)|; (IF (SSGET "x" '((0 . "MULTILEADER"))) (PROGN (SETQ ss (VLA-GET-ACTIVESELECTIONSET (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))) (VLAX-FORent ss(IF (VL-STRING-SEARCH txt (STRCASE (VLA-GET-TEXTSTRING ent))) (PROGN (VLA-CLEAR ss) (INITGET 1 "Yes No") (SETQ n_txt_LBL (STRCAT "
=>> " LBL " Label EXISTS! Add another " txt "? ") y_n (GETKWORD (strcat n_txt_LBL " [Yes/No]: ")) ) (IF(= y_n "Yes") (PROGN (ppa-L-

[Code]...

My MLeader has a _TagBox & it is the attribute of the _TagBox that I am trying to check/compare the "txt" value.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Attach Leader To Existing Block

Oct 24, 2013

Is there a way to attached an already exisiting placed block to a leader. If so, is there a way to do it to all the existing blocks, that are of the same block definintion, at once?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Serial Letters And Numbers From Existing Ones

Mar 2, 2013

Lisp file to get serial letters and numbers from existing ones,

I got a lisp file (attached) from experts in the form which does generate serial letters and numbers from existing ones.

The issue with this lisp file is that it doesn’t give the opportunity to choose the direction of numbering (top to bottom/bottom to top/left to right/right to left) as shown in the screenshot below

How this lisp can be developed to give the user the chance to choose the direction of numbering?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Modify The Existing Parametric Parameters?

May 2, 2013

Is there a way to modify the existing Parametric Parameters that are in the Parameters Manager using LISP?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Adding Variable To Existing File

Oct 4, 2012

I have attached 2 lisp files. datblkx5 makes a block of selection, inserts the block with a 5x distortion, explodes it, and corrects the text for width factor and text height. This one works fine.

I wanted to add the feature of scaling my selection with a user input value. This is the lisp datblkxxx. This one doesn't work. (that is it doesn't correct the text for width factor). I can't figure it out.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Mirror MTEXT Existing In Drawing

Aug 2, 2012

i have a situation that i need to mirror a lot of MTEXT exisiting in my drawing with following needs ( as attached CAD file) :

- MIRRTEXT = 1

- original text retain not deleted.

- mirrored texts become on another layer with another color.

- mirrored texts exactly become over the original text.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Entmake Mtext Start And Stop Underline And Styles

Jun 4, 2013

I am trying to create an mtext entity using entmake with different text height, text style and underlining. I have a subroutine that works fine. However - I would like to use different text height, text style and underline for the Title Text vs the following lines.

Here is the subroutine I already have -

(defun Create_MText (MT_PMS MT_Layout MT_Layer MT_Style MT_Justify MT_Point MT_Rotate MT_Size MT_Width MT_Title MT_Body / )
(setq FSC_MText
(list
(cons 0 "MTEXT")

[Code] .......

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Nil At The End Of Command

Jun 22, 2012

I have a routine that work fine, but I receive a nil at the end of command. How to fix that?

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: DOS DIR Command

Oct 27, 2012

I need a program that simulate this DOS command: dir /on/b *.dwg >list.txt

it list all dwg files on current open dwg file folder and sort them and finally put them in a text file with list.txt name. something like thistype list.txt)

test1.dwg
test2.dwg
test100.dwg
test256.dwg
test1005.dwg

(sort alphabetically and logically) because of disabled DOS utility in my PC I need a pure lisp functions, I tried to wrote this program but I couldn't!!

(defun c:listMaker()
(vl-load-com)
(setq path (getvar "dwgprefix"))
(setq fn "list.txt")
[code]...

and also I need a append a string(='This Is EOF') in the last line of the "list.txt" file.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Can't Get While Command Right?

Apr 13, 2012

I am trying to get my original layer and lintype reinstated after the user is finished with the pline..I know Im suppose to use the while command but am now completely lost on which way to do this

(DEFUN c:TEST1 ()(if (not (tblsearch "LTYPE" "MYWC")) (command "-linetype" "LOAD" "MYWC" "C:/COUNTER.LIN" ""));SECOND PROGRAM...;CREATE CORESPONDING LAYER...(command "._Layer" "Make" "WC LEIDING" "Ltype" "Continuous" "" "Color" "211" "" "")(SETQ MYOLDCELTYPE (GETVAR "CELTYPE"))(SETVAR "CELTYPE" "MYWC")(while (PROGN(COMMAND "pline")(SETVAR "CELTYPE" MYOLDCELTYPE)))

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: CANNOSCALE Value Needs To Match Existing Named Scale

Jan 18, 2012

The crux of the matter is that the CANNOSCALE value needs to match an existing named scale.  This lisp is part of a bigger lisp and I need to pass a variable into it.  Here's what I have:

(setvar "CANNOSCALE" (strcat "1" = " (rtos variable 2 0) "'"))

But I get this error when I try to run it.

; error: bad argument type: numberp: nil

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Move Existing Objects To Snap Grid?

Dec 22, 2012

I have a slightly unusual query that I can't seem to find a solution for elsewhere. I have an existing OS plan that is 'off grid', and would like to adjust the vertices at the ends of all the existing lines and polylines so that they all sit on a grid point, ie round all vertices to the nearest whole number. Is there a quick command or script that does this?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Error In While Command

May 22, 2013

We have a lisp routine that I co-authored ages ago and then haven't done much programming in about 7 years.  I seem to have forgotten much of my language skills.  This portion of the lisp routine was running fine in autocad 2005 which is what the computer had on it, and it doesn't run on autocad 2010. 

I've narrowed it down to the while statement which is why you see it commented out, but that portion is necessary.   My main question is was there a change in the language specifically the while statement between 2005 and 2010? 
 
; GET LINES OVER 10" AND THROW OUT (if (= (cdr(assoc 0 outerinfo)) "LWPOLYLINE") (progn (setq remlenouter 0.0) (setq numseg (cdr(assoc 90 outerinfo))) (setq edd (member(assoc 10 outerinfo) outerinfo)) (setq n1 0) ;(while (< n1 (- (* numseg 4) 4)) ;(setq dist (distance (cdr(nth n1 edd)) (cdr(nth (+ n1 4) edd)))) ;(if (>= dist edmmax) (setq remlenouter (+ remlenouter dist))) ;(setq n1 (+ n1 4)) ;) ; end while (setq dist (distance (cdr(nth n1 edd)) (cdr(nth 0 edd)))) (if (>= dist edmmax) (setq remlenouter (+ remlenouter dist))) ) ; end progn ) ; END IF

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Looping A Command

Aug 26, 2013

I am using AutoCAD 2011. I have a lisp that I have created/modified.

What it does:

Allows me to Select a layer that I call out and change its color properties back to bylayer.

(i primarily use this when i am cleaning up my drawings, I turn them all to gray with another command i have then i run this one to find all the entities on that specified layer)

What i am trying to do: 

I would like this command to do a loop.  So say i type in a layer name that does not exist, instead of running through the rest of the command i want it to revert back to "specify layer name" until the correct name is entered for that layer.

Here is the lisp:

(defun cLL ()
(setq varLayer (getstring t "
Specify Layer Name: "))
(sssetfirst nil (ssget "X" (list (cons 8 varLayer))))
(command "change" "p" "" "p" "c" "bylayer" "")
(princ)

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved