AutoCAD Visual LISP / AutoLISP :: Program Loop To Draw Lines With Rubberband

Oct 4, 2012

i am writing something that will draw consecutive lines with a rubberband to be used as a leader from a block's insertion point.  this:

(WHILE
 (SETQ LN (GETPOINT "
Select Next Point (ENTER to Finish) : "))
 (COMMAND "LINE" (GETVAR "LASTPOINT") LN "")
)   

works, but does not include the rubber band.  i tried:

(WHILE
 (SETQ LP (GETVAR "LASTPOINT"))
 (SETQ LN (GETPOINT LP "
Select Next Point (ENTER to Finish) : "))
 (COMMAND "LINE" LP LN "")
)   

which includes the rubberband, but will not exit the loop. The last break source in VLIDE shows that  

(GETPOINT LP "
Select Next Point (ENTER to Finish) : ") is casuing an error.  Placing
 (SETQ LP (GETVAR "LASTPOINT"))

 outside the loop causes all lines to be drawn from the same point rather than the endpoint of the previous line. 

View 9 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: How To Draw Triple Or More Lines

May 8, 2013

Lisp code here for draw for example triple parallel line ? each line will be own layer and color..

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Code To Draw Grid Lines

Jan 1, 2014

I have this code to draw grid lines within a rectangle:
 
;Variable settings(defun var_set () (setq *var_lst* '("cmdecho" "osmode" "expert" "plinewid" "dynmode") *var_usr* (mapcar 'getvar *var_lst*)) (mapcar 'setvar *var_lst* '(0 0 2 0 0)) (vl-load-com))(defun var_reset ()(mapcar 'setvar *var_lst* *var_usr*)) (defun *error* (msg) (if (not (member msg '("console break" "Function cancelled" "quit / exit abort" "" nil)) ) (princ (strcat "
Error: " msg)) ) (and ;(vl-bt) (var_reset) ) (princ) ) (defun string-list (data) ;by lee-mac @theswamp (if (vl-string-search "@" [code].........

The above gets me the grid lines; but I have a block inserted at both ends of the grid line; how do I get the selection of those entities (selection set "frame") after each array?

or I would need to map a point list and draw each grid individually how do I go about that?

Attached is the sample of the output I'd like to achieve using LISP.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Simple Program That Changes Color Of M-leader Lines?

Mar 19, 2013

have a simple lisp (no v.b.) program that changes the color of m-leader lines in acad 2010?

IV 2010 Suite
Digital Storm PC:
EVGA & Intel components
Win 7 Pro 64 bit

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Divide Spaces With Max Gap - Draw Lines Between 2 Points

Feb 6, 2012

I have to put some trusts between two beam. It sounds easy but i'm unable to handle the divide and round off commands in the lisp. See attachement also.

To draw my trust between the 2 beams, what I normally do, is that I manually take the distance between the two points say it's 10 000 and wrote it down. Then I divide it by my max gap, say 1200, it is the max space between trust.

10 000/1200 = 8.333333 that's the result of how much trust and space between them that i'll need, 8 trusts, 9 spaces between the 2 beams. (That is what I'm unable to do in the lisp, tell it to round off 8.333 to 9 and use 9 for divide command)

What I manually do at this point to draw these trust is that I must create a temporarly line between the 2 beams, perpendicularly to these and divide it by 9.

It gives me 8 cross (or point) to draw my trusts. All this is long to do manually because I have many bay in building and I have to redo this operation for every the bay.

So, what I would like the lisp to ask is:

Specify distance between two beams (Between where and where) :

Specify the lenght of the trust :

Specify max gap: I would like to answer a number here, say like 1200 max

(The lisp should draw the lines on the current layer, color and linetype of the current layer and not draw a line at the beginning and at the end because that's where my Beams are. I hoped you understand, see attachement.

Should also have something that handle a ESCAPE hit or cancel, something like this:
 
(defun trap1 (errmsg) (command "_.undo" "_end") ; undo end (setvar "osmode" oldsnap) ; restore variables (setvar "cmdecho" 1) ; enable cmdecho (setq *error* temperr) ; restore old error handler (prompt "

[Code] ....

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: While Loop With Prompt

Nov 19, 2013

I am trying to put together a loop to enter a number greater than the previous number entered. Below is my mockup and I just cannot get it.

(defun c:22 () (while (setq d (getreal "
Specify diameter: ")) (setq $d d) (while (if (<= d $d) (progn (prompt "
Specify greater diameter.") (setq d (getreal "
Specify diameter: ")) ) ) ) (setq p1 (getpoint "
Specify point: ")) (command "CIRCLE" p1 d) ))

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Nil - Stop While Loop?

Oct 22, 2013

I am have trouble trying to figure a couple of things in the following code.

First - in the IF statement if "SD" is >= ask "Specify LAST strata number". How do I add nil?
Second -  After I "Specify the LAST strata number", How do I stop the loop?
 
(defun C:22 () (setvar 'osmode 0) (or $S (setq $S 10)) (setq S (getdist (strcat "
Specify scale [Inches equal a Foot] <"(rtos $S 2 2)">: "))) (if (= S nil) (setq S $S)) (setq $S S) (or $BD (setq $BD 7)) (setq BD (getdist (strcat "
Specify boring depth in feet <"(rtos $BD 2 2)">: ")))
[Code] ........

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: While Loop And User Defaults

Apr 25, 2012

I have a little LISP I have been working on that creates a text object as a "label" for 2D ductwork our company does. It makes a field for the mlinescale as the duct width, combines with user input for duct depth, and prompts user for location to place the text. The routine is functional...however, I would like to tweak two things that I cannot figure out.

First, I would like the command to continue until the user escapes, similar to the "multiple" command in AutoCAD. I have tried adding a while loop to the majority of the routine..which works until the user escapes...then my error handler undoes everything.

Second, when asking for user input, is it possible to ask for user input without a default the first time, but thereafter remember the input as a default?

Below is the code in question...not including error handler, etc. :

(if (= ducttemp nil)(setq ducttemp 12))
(initget 6)
(setq ductdepth (getint (strcat "
Enter duct depth in inches <" (itoa ducttemp) ">, or Esc to end: ")))
(if (= ductdepth nil) (setq ductdepth ducttemp) (setq ducttemp ductdepth))

[Code] .........

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Unable To Get Out From While Loop If Press Enter

Jun 18, 2013

I am just a begineer for auto lisp.  I wrote my first program, but got stuck,  I am unable to get out from while loop if i Press "enter".

(defun c:arsh ()
(while
(setq p1 (getpoint "
pick point :"))
(setq l 1500)
(setvar "osmode" 0)
(initget 7)
(setq p2 (polar p1 (dtr 0) l))
[code]....

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Loop File Names In Command Prompt?

Dec 6, 2012

I have a parent directory with x-amount of folders contained inside. I say X-amount because I would like to keep adding or deleting folders as time progresses. I want the folders contained within this parent directory do be read into a lisp variable and then be printed to the command prompt till every folder is displayed by name, then the loop may stop.

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Loop Based On Number Of Selected And Filtered Objects

Jun 13, 2013

I am looking for a way to extract (filter) all polylines, and loop a lisp based on the number that are found within a "W" selection window.I am frustrated getting "malformed list" or errors, even after defining "n" for repeat.The code I have so far looks like this:

(defun cWW (/ p1 p2 sspw myObj ss)
(setq p1 (getpoint "
Pick first corner: "))
  (setq p2 (getcorner p1 "
Specify opposite corner: "))
  (if
   (setq sspw (ssget "W" p1 p2 '((0 . "*POLYLINE")))
 [code].....

Without the (repeat () portion, it was working ok with selection window, however it only would run the commands for a single polyline.  What needs to be done without overhauling the code?  The lisp has worked on a drawing-wide basis, however needs to run on only on user-windowed polylines since there are other polylines within the drawing which are attached to layouts via viewports. 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Intersect Between Two Lines Using Start And End Values Of Two Lines

Oct 11, 2013

With all of you fine teachers, I have the know-how to get the start and end values of a line.

Do you think there is a way to get a point returned that represents the true intersection of the two lines, without having to involke a user defined "getpoint" function using "intersect" osnap?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Construct Lines Between Lines Ending Points Multi Selection?

Aug 3, 2013

I want to construct lines between every two line ending point by multi selectio window instead of drawing it manually between lines ending point ?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Have Arrow Leader Convert To Loop Leader In One Click

Jun 1, 2006

Is there a way to have the Arrow leader convert to Loop leader in one click. Our company standards use diamond tags and sometimes i have to change the arrow to loop by inserting a leader.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Pausing In A Program To Allow Printing?

Jun 13, 2013

I have a lisp program which will create a cover sheet for my electrical drawings by extracting data from the title block. Once this is done, I manually print the cover sheet.

What I would like is to create the cover sheet, have the lisp program pause, print the cover sheet, then when printing is done, quit the drawing file so the cover sheet does not remain.

I tried several approaches, but the lisp program finishes before the cover sheet prints.

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Program Variable Names?

Feb 28, 2012

Is there anyway to program variable names?

What I was thinking of was in a loop some times I need multiple sets of similar variables but am not sure how many sets I am going to need. I would like to be able to increment the variable names each time the loop runs.

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Draw Line In A Layer

Jun 5, 2013

How do I select the layer in which I want to draw?

for example i draw two line and Each of them has to be in different layer.

How do I select the layer  which I want to draw?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Polyline With Clipping Outside

Mar 7, 2012

is there a way to draw a polyline and have autocad clip everything outside of that polyline and discard it so that i end up with a smaller drawing.  only the information in that polyline, nothing outside of the polyline

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Draw Text Entity In 3D

Apr 29, 2012

how to draw a text entity in 3d, where I know the 3d ins point, and the plane it should be flat to.

I have not drawn text or inserted blocks programatically before where the plane they lie on is not flat.

I have done it before by setting a ucs and drawing stuff, but now I want no switches of UCS involved.

[URL]

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Rectangle Dimension?

Apr 17, 2013

how I would go about writing a function that would calculate the length of a diagonal of a rectangle using SQRT function? I've been trying but so far nothing!

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw All Objects At Same Time?

Sep 24, 2012

I have made a lisp routine to draw lines on polyline. And here are a lot of lines on it. So using comand

"(command "line" pt1 pt2 " ")"

takes a lot of time. Is here a way to creat lines in memory or similar and only then draw them all on screen?

I have search but coudin't find any info. I do not know how to formulate a query.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Unable To Draw A Line

Sep 18, 2013

I've written my first little Lisp function.What it's for is drawing a simple borehole profile that can then be used to draw stylized cross sections on top of it.

Upon start the lisp, pick a point on screen (to get the X coordinate [x1 below]), then enter ground level at the command line [g1 below], then enter as many thicknesses as are present in the borehole log (will vary, but typically between 3-12). These I added to a list, because that seemed to make sense when I did it.

What I want it to do then is draw a pline from x1, g1 down to the next point (x1,g1 minus the 1st thickness), then the next (x1,g1 minus the 2nd thickness) etc., to the bottom of the borehole.

Then my CAD guys can sit there, and using the borehole logs, enter the values of the boreholes and it draws them on the screen, making it easy to join th dots.

It might be good if it placed a Acad point at each point as well, but I'm not overly bothered about that at the minute.

Here's my attempt so far.

(prompt "Type 'e1' to run...")
(defun c:e1 ( / )
(command "graphscr") (setq x1 (getpoint "
Pick insertion point:")) (setq x1a (car x1))
(initget (+ 1 2 4))   (setq g1 (getreal "
Enter ground elevation: "))
(initget (+ 1 2 2)) (setq lvllist nil )   (while   (setq lvl (getreal "
Enter layer thickness <Exit>: "))   (setq lvlList (append lvllist (list lvl))) )
(princ) )

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Square By Area

Nov 27, 2013

I would like to be able to draw squares by the area they should have. So that if I need a square of 50m2 autocad automatically draws a square of sqrt(50) x sqrt(50)

Because right now I have to draw 200 squares with 100 different areas and I have to calculate and manually draw each one of them.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Draw Polyline Between Two Blocks Of Same Name

Nov 13, 2013

i need a vlisp program to draw polyline between two blocks.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Bounding Box At Current UCS

Oct 16, 2013

The first rectangle is drawn from 0,0 at the World Coordinate System. There is never any trouble with the code below when the objects are drawn at the WCS. The problem is when I try to draw a bounding box around an object while in another UCS. It seems that it always draws the bounding box at the WCS instead of my UCS. I have used (trans <pointlist> 0 1) on all combinations it seems and I still cannot get it to draw the bounding box at the current UCS. 

(defun c:GetFromBoundingBox (
/
*ACAD_DOCUMENT*
mspace 
pSelectedObject
lwLeft
upLeft
lwRight
upRight
[code]...

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Program Hangs Up For No Apparent Reason?

Oct 21, 2013

I have an AutoLISP program that hangs up for no apparent reason. I can run the program with an Alert in the loop. The program is a sheet generator, creating a border (insert with attributes), dimensions and MultiLeaders in Model Space, then a new Layout Tab is generated and the new elements are CHSPACEd into the new layout. An Alert temporarily halts the program once the task of a new Layout is created. In this form, the program works as designed. However, if I comment out the Alert, the program hangs up as if in an infinite loop. Also, hitting Escape does not cancel the AutoLISP, I must use Task Manager to end AutoCAD instead. My computer was recently upgraded to Win7 64-bit. I'm running 64-bit versions of software. (AutoCAD MAP 2011).

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Blocks Not Inserting Properly Through Program

Oct 13, 2011

Have an AutoLisp program that inserts a block with attributes. Been using it forever. Yesterday I ran the program and somehow when the block is inserted, it skips the Y scaling factor. The program should insert a block at a point with a X scale of 19.2, Y scale of 19.2, Rotation at 0 and then four attribute values.

What is happening is the block is inserted at the correct point and X scaling factor, but the Y scaling factor goes in for the Rotation angle (19.2 degrees), the Rotation angle goes in as the first attribute and the remaining attributes are shifted over and the last attribute is missing.Line of code is:

(command "INSERT" "CNVTAG" inspt scl scl 0 text1 text2 text3 text4)

The command prompt displays:

Command: (command "INSERT" "CNVTAG" inspt scl scl 0 text1 text2 text3 text4)
INSERT Enter block name or [?] <NEWWHDBORD>: CNVTAG
Units: Inches   Conversion:    1.0000
Specify insertion point or [Basepoint/Scale/Rotate]: Specify scale factor <1>:
19.20000000000000
Specify rotation angle <0>: 19.20000000000000
Enter attribute values
Conveyor number: 0 Conveyor Speed: 5315-BCS Motor Horsepower: 1.5hp Release
Mode: 45/90fpm

I looked at the system variables INSUNITS, INSUNITSDEFTARGET and INSUNITSDEFSOURCE AND THEY ARE ALL SET AT 0..Currently using AutoCAD 2010.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Extract Attribute Tag Value And Draw Polyline

Apr 25, 2012

I have a inserted block with 4 tags for Length, Thickness, Elevation and Width.How can extract attributes tag values and draw a closed polyline + 2 internal lines, parallel to the block?

Block Name: ID_DATA
Tags: LEN, THI, ELE and WID.

Each internal line placed in a third width.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Insulation Hatch Around A Circle

Jul 23, 2004

Routine that will draw a insulation hatch around a circle?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Polyline Which Point From Sub-entities Possible?

Jun 28, 2013

I continue learning....

(setq ins (vlax-ename->vla-object ( ssname sele cod)) nombre (vla-get-name ins) ) (setq bloque1 (vla-item (vla-get-Blocks (vla-get-Document ins) ) nombre ) ) (setq s_ent1 (vla-item bloque1 1)) (setq pt1 (vla-get-startpoint s_ent1 ))(setq pt2 (vla-get-endpoint s_ent11 ))(setq s_ent2 (vla-item bloque1 2)) (setq pt3 (vla-get-startpoint s_ent2 ))(setq pt4 (vla-get-endpoint s_ent2 ))(command "_pline" pt1 pt2 pt3 pt4 "c")

Why dont draw de _pline?

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Doors And Windows In 3D From Block In 2D

Jul 4, 2013

i make  a lips that  draw doors and window in 3d from block in 2d......the problem..It does not work in all autcad¡¡ the same version but different  pc.

View 9 Replies View Related







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