AutoCAD Visual LISP / AutoLISP :: Line From Origin To Object Centers
Jan 3, 2013LISP routine which will draw lines from the center/insertion point of multiple objects to 0,0,0 ?
View 9 RepliesLISP routine which will draw lines from the center/insertion point of multiple objects to 0,0,0 ?
View 9 RepliesI want to know the correct way to find the offset origin of a layout in an AutoCAD drawing. Let say I have a drawing that has many items on it. And I create a layout showing just the items in the lower right corner of the drawing. I want to know the offset origin of this layout relative to the Model space.
I came across some LISP commands that are supposed to do just that:
(vl-load-com)(setq activelayout (vlax-get (vla-Get-ActiveDocument (vlax-Get-Acad-Object)) 'ActiveLayout ))(setq activeplotorig (vlax-get activelayout 'PlotOrigin))
Unfortunately, the commands don't seem to work because it always returns (0.0 0.0). That cannot be right.
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 RelatedI have a rather simple 3rd party custom object... I tried to get its bounding box but the coordinates that come back don't seem to relate at all to the object.
What I'd like are the coordinates of two nodes the object contains...
Is it possible to apply the autocad cursor in some why with the node object snap to get their coordinates?
I am trying to draw a line between two lines and I put together the following. It works great if the start/end points are perpendicular to each other. How do I solve if line one start point is in a positive direction and line two is in a negative direction?
(defun c:test ()
(setq L1 (car (entsel "
Select the first line: "))
L2 (car (entsel "
Select the second line: "))
)
[code]....
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...
I need to get VLA-Object from block name.
here there is a code to get block name from VLA-Object:
(vlax-get-property obj (if (vlax-property-available-p obj 'EffectiveName) 'EffectiveName 'Name) )
but I need the inverse of this code exactly:
blockname(as a string)==>VLA-object
(defun GetVLA_BName (BName).......
so, how can I do it?
I am trying to write a simple (or at least I thought it was) code to flatten a 3d object into a 2d shape. For some reason after ACAD runs the lisp it recognizes the flatten command but it will not select all. this is what I have:
(defun c:fl () (command "flatten" "all") )
I have even tried the pick first command, to select all then run the flatten command but that still doesn't work.
I need to place a circle, of a user-defined radius, as a marker at the endpoints of all lines in a drawing. how to accomplish this using lisp? It doesn't matter if they overlap; I can use OVERKILL to delete those objects.
I started the code with:
(defun c:cmark ()
(setq crad (getdist "
Specify radius: "))
)
But don't know how to cycle through the objects, determine the end points of lines only.
Is there any simple code for to sum length of lines which is i am choosing and copying result to chosen attribute tag ?
View 1 Replies View RelatedHow 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?
There are many lisp that draw offset line but what about opposite way , I have wall of double line i need to delete one of them let's say inside wall line .
why i need to do this usually when i tracing in external program like autocad architecture or Revit or archicad i just need outline of exterior and interior walls !.
is there way that can delete the offset line ?(or within range predefined in lisp to prevent interfering of lines deletion).
I have little Autolisp experience, what I need is a lisp routine that will divide a 3D Poly line to say about 1000 points and add index to the points from the start of the line to the end of the line. It is very important that the index be from the start to the end of the line, because we extract the info to excel and then use the x,y and z co-ordinate of the points on our hydraulic analysis program. We need to have the index and the x, y and z co-ordinates on our Excel sheet sorted by index and not by x, y and z.
To be more clear the 3D poly is a pipeline profile so we need to have the points in order by index and not by x, y and z.
Is it possible to control the UCS without using the command line? I'd like to access it and control it with vlisp much the same way I can access DXF groups and manipulate insertions. Seems like it should be possible to play with it's definition inside the object model.
View 5 Replies View RelatedI need lisp that do a line between 4 lines.
View 7 Replies View RelatedI have a custom command that I can initiate (c:TxtE). The function starts running but I need to begin adding several inputs at the command line following this. (ex: "4" "all" "" "oldtext" "newtext"). How do i do that within lisp once the custom command has already begun? If I need to modify the function how would i pass all these as optional type variables?
View 7 Replies View RelatedSomehow, I manage to turn of one variable that display errors on command line.
For example:
(seq a 6)
suppose to return, on command line, something like:
error no function definition: SEQ
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) )
I am trying to create a report of line lengths based on linetype.
I have built a list that looks like this...
(("CUT4SS" . 859.566) ("CUT4SS" . 862.231) ("CUT4SS" . 927.651) ("CUT6SS" . 1158.48) ("CUT6SS" . 509.903) ("CUT6SS" . 2840.31) ("CUT4SS" . 967.76) ("CUT4SS" . 508.73) ("CUT4SS" . 111.065) ("CUT4SS" . 483.216))
I want to take this list and create a function to create a list of total lengths i.e. the CDR's.
(("CUT6SS" .total length)("CUT4SS" . total length))
There is a very complecated drawing. Texts are on a line and crossing a line or something like that. Some texts has insertion points on the line. When the line is selected by LISP, only the specific texts with insertion points on the line are selected. Does it make sence?
View 8 Replies View RelatedAny lisp programme for creating a line profile and chainage. I have attached a sample drawing. The blocks on the line have elevation and lines are drawn from the datum .If i manually draw it will take too much time.
View 9 Replies View RelatedI have a lisp file that reads in a point list from a text file and creates a number with a circle around it for every point, then a line from one circle to the next in line with the center point of each circle. Is there a simple way of making the lines "go behind the circles". The portion of code that creates the circles, lines and text is as follows and a cutout screen dump of what it looks like is below.
(setq amount 0)
(foreach item lines
;;; ;;
;;; Create the text ;;
;;; ;;
(setq x (+ (atof (nth 2 item)) (car pt_origin)))
(setq y (+ (atof (nth 3 item)) (cadr pt_origin)))
[Code]....
IV 2010
I am trying to get the end points of an invisible line it would be the line that you offset I know all about polar I just don't know which angle to add or subtract and I will pick the point on the side I want it to be on I am going to pick 2 lines and I want them to offset invisible lines in the middle the lines are not parallel.
View 8 Replies View RelatedCan I select a line and get the nearest endpoint so I can do something to the line using the endpoint as a base?
It will include an ssget and an osnap "end" in the code, but not too sure how to put it together.
Lisp routine that will rotate Mtext to the same angle as the angle of a selected line and the allow you to place the mtext object where you wish.
I know there is an lisp out there called RTL that will allow you to do this with regular or Dtext, but I will not work with Mtext.
I was looking for a post on the subject of line and circle intersections and found one that Bill Z had posted. I decided to incorperate one of the replies into my own code. In particular Luis Esquivel's code. With some minor modifications I was able to add the onseg argument that extends intersection points for the line to the circle. I also modified it to return only one point or two points depending on the line and circle supplied and the onseg argument. It seems to work great.
; test function
(defun c:go ( / )
(ed_init)
(while
(or
(not (setq ent (entsel "
[code].....
How to access the information stored with an AcDbScale object using Visual Lisp. I can convert the vla-object to an ename and then use association codes to extract the data, but surely there's an easier, more direct alternative.
View 9 Replies View RelatedHow to fade an object (block) in and out?
View 2 Replies View Relatedi am trying to add a reactor to ddatte command, would like to know which object was being edited, the ename or object name (ssget "P") does not seem to be the one
View 5 Replies View RelatedI am looking for a lisp routine which will allow me to mirror an object that I pick automatically. I don't want to have to pick the two points to set the mirror line. I just want the point I pick on of the object I select to be the point of the mirror. If that can't happen, I was wondering if the object could mirror at its insertion point (like if it were a block or a text.
View 7 Replies View RelatedWe use multi-leader objects in our drawings. When the multi-leader and its value are to be replicated throughout the drawing, we create mleaders with fields that show the contents of the first mleader. That way we can update only the value in the first mleader and all of its children will update as well. It works nicely for us.
Here comes one snag. If one of us opens a drawing with which we are not intimately familiar, we don't know which mleader is the parent of which children. There might be fifty parents and four hundred children in a drawing so going through them by hand is a big productivity drain.
What I need to do is write a routine that will let the user select the mleader that includes the field and have the routine highlight and/or zoom to the parent object.
I thought I should be able to find that info in the dxf codes for the mleader, but I am either missing it or it's not there.