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
ADVERTISEMENT
Aug 28, 2012
I have a customized button to draw an ‘ac-arrow’. I created a lisp to create the layer “G-ANNO-LEDR”
if the layer name is not found. The advanced part I would like is:
Current layer: E-ANNO-WIRE
Ac-Arrow Leader: G-ANNO-LEDR
OPTION 1:
If, say I am on current layer “E-ANNO-WIRE” and need to draw my “ac-arrow” leader, and continue working
on the original layer “E-ANN-WIRE” (and have the leader be drawn [remain] on the layer “G-ANNO-WIRE”).
With this option, I have the block “ac-arrow” imbedded in my template drawing file to have the block at hand.
With this option, the layer “G-ANNO-LEDR” will be created IF it is not on the drawing.
OPTION 2:
- Currently be on layer “E-ANNO-WIRE”
- Bring in the block “ac-arrow” from my block library “L:AutoCADSymbols”
- Draw the “ac-arrow” leader which will be on layer “G-ANNO-LEDR” (this layer created IF it is not
on the current drawing).
- After the leader is drawn’
- Be put back to the layer I was, “E-ANNO-WIRE”, and continue working.
The OPTION 2 is what I would really like to have. A while back, I happen to see one like OPTION 2, but I cannot
find it anymore on the users groups. I have been searching for a while now.
Currently, I use the button in my customized toolbar (see image) and have to have the “ac-arrow” block in my drawing and have its layer created in the drawing.
View 1 Replies
View Related
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
Jul 7, 2012
I have a list with many points is it possible that i can draw a line or polyline on those points using MapCar function.
View 6 Replies
View Related
Jun 5, 2013
why do not draw the line between ptm1 and pt3?
(defun c:PUNTOM (/ pt1 pt2 pt3) (setq pt1 (getpoint "
Initial point : ")) (setq pt2 (getpoint "
Final point : ")) (setq pt3 (getpoint "
Offset : "))(setq ptm1 (mid (pt1 pt2))) (command "_line" pt1 pt2 "")(command "_line" ptm1 pt3) (princ));;;;;;;(defun mid (p1 p2) (list (/ (+ (car p1) (car p2)) 2.0) (/ (+ (cadr p1) (cadr p2)) 2.0) ));;;;;;;;
View 9 Replies
View Related
Jan 9, 2013
This is to trim a line that crosses another. I draw lots of plumbing plans. It draws a circle based on 'dimscale', trims a line to that circle, then erases the circle. The problem is if you miss the trim point (PT2) it does not erase the circle and you lose your object snaps.
;Pipeline Break
(Defun C:bb (/ s1 ds1 r1 PT1 PT2 AX)
(setq s1 (getvar "osmode"))
(setq ds1 (getvar "dimscale"))
(setvar "osmode" 63)
(setq r1 (* ds1 0.03125))
(setq PT1 (getpoint "
[code]....
View 9 Replies
View Related
Oct 7, 2011
There are a ton of lisp to match text rotation to a selected line, but not vice versa.
View 9 Replies
View Related
May 22, 2013
I'm looking for a lisp routine that will draw a line between all matching numbers that are repeated 3 times or more in a selection.I'm using AutoCad 2012.
View 9 Replies
View Related
Sep 19, 2013
I'd like to change a layer's color from command line because of a user icon. I figured out from previous topics that I should use macro similar to this: ^C^C_filedia;0;-la;s;Verdeckt (ISO);c;1;l;dashed;;_filedia;1;re;
(I want to use this macro to change layer's linetype, too, but that's not the point)
The only problem with this macro: layer's name contains a space therefore Autocad tries to recognize Verdeckt as a command (and macro interrupts there) instead of setting Verdeckt (ISO) as the current layer. I've tried using different quote marks, none of them worked (' and " and <>). I hope there's a method for entering a parameter that contains space.
Software: Inventor Series 2011 SP1 x64
OS: Vista Business x64
CPU: E6400
RAM: 2*2Gb GeIL
VGA: Quadro FX 550
View 5 Replies
View Related
Aug 9, 2013
i have line in the drawing that exists on layer A-Wall it has different lineweight 0.05 from true wall. Now usually my routine : i select this line and then select similar to convert it to layer glazing.
i need lisp that by one command convert the objects on layer A-wall with layer 0.05 only to glazing.
View 9 Replies
View Related
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
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
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
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
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
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
Nov 13, 2013
i need a vlisp program to draw polyline between two blocks.
View 3 Replies
View Related
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
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
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
Jul 23, 2004
Routine that will draw a insulation hatch around a circle?
View 9 Replies
View Related
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
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
Jul 21, 2003
Is there a lisp routine to draw 3D object by the LOFT way ? .
View 4 Replies
View Related
Sep 2, 2013
I have drawings with a lot of polyline objects. I need a routine which will draw multilines by coordinates of vertexes of this polylines. For example, if there is a pline with coordinates 10,10 - 20,20 i want to draw in other layer MLINE with the same coordinates. I know it's should be simple but can not gues how to do it. I've never used LISP before.
View 5 Replies
View Related
Sep 15, 2000
how to draw a geodesic dome shape? some sort of lisp routine perhaps...
View 7 Replies
View Related
Jul 18, 2012
I'm trying to write a lisp routine to create a two line MLEADER but i can only get one line of text. Creating the MLEADER manually from the command line i just have to hit enter after the first line of text to add a second line. How would i do this in a lisp routine?
View 2 Replies
View Related
Oct 21, 2013
Can a AutoLISP command be written to read an attribute in a block and draw a circle with the attribute as the diameter using variables? The appilcation is taking the diameter of a tree trunk (the attribute), multipling by 12, and drawing the canopy circle on hundreds of those blocks. So the circles drawn will vary in size.
Not sure how this could be set up, i'm not familiar with LISP writing at all.
1) Read block, single, mulitple or definition?
2) Read Attribute
3) Varaible of attribute, (attribute is an inch measurement...it needs to be multipled by 12 to get feet for final use as circle diameter drawn)
4) Draw circle, variable, with diameter coming from attribute variable (attribute in inches that is multipled by 12)
5) Center point or circle to be block's base point
View 9 Replies
View Related
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
Mar 18, 2008
I need to draw an ellipse at a specific point on a drawing.
i can calc the major and minor and i have a polar point of where it should be drawn.
i just need the code to draw the ellipse.
View 4 Replies
View Related
Jan 3, 2014
I do a lot of repetitive tasks in my daily drawings and I’d like to make life easier! I was researching how I could write a lisp to draw a walkway path for a roof. I came across a couple of interesting posts but couldn’t follow the code because of my lack of understanding the language.
So what I do is draw a 30” x 30” square (using the rectangle command). Then copy it so there is a 2” gap between them. Then I go back and hatch them with a dot hatch scaled to 96. What I’d like to do is type a command and it would draw the walkways for me and hatch them if possible. The problem is the last one is a custom cut size depending on the length of the walkway run?
Now I know I can draw a line, draw the square, hatch the square, array it on the path with set distance between items, then fix the last one so it looks the way I want it to, and then delete the line. But why do all that when I have a program that allows me to customize it to be done for me?
View 6 Replies
View Related