AutoCAD Visual LISP / AutoLISP :: Defining A Grid Of Points With Polar Coordinates

Jun 20, 2011

I'm trying to define a grid based on polar coordinates.

Can be produced using the following MATLAB
n=1:50000;r=sqrt(n);t=360/((sqrt(5)+1)/2)+1)*pi/180*n;plot(r.*cos(t),r.*sin(t),'o')

I need to insert points based on the polar coordinates defined by the equations. I knew a little bit of LISP 10 Years ago, now it's a total blank. I've been trying to write a script to make this work but after 5 days I'm still without sucess.

View 8 Replies


ADVERTISEMENT

AutoCAD Visual LISP / AutoLISP :: Defining Points For Spline Command

Apr 4, 2012

I am working on a little lisp routine to draw splines, but can't get it working. The basic idea is that i first select a set of points that i can feed to my spline command.
 
(defun c:test2 () (setq pt (getpoint "
define point:")) (setq ptlist nil) (while (not (equal pt nil)) (setq ptlist (cons pt ptlist)) (setq pt (getpoint "
define point:")) ) )

Now i need to draw a spline based on these points. My plan whas to simply use the acad command itself. But this option didn't work.
 
(command "spline" ptlist "")

Then i tried using the vla-addspline command. But i can't even get this one working .

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Union Items After An Array Polar

Mar 12, 2012

I would like to do an array polar for 4 items and union with the command "union" all of them automatically.. how can i do that in a lisp ?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get X / Y Coordinates Of A Pline

Feb 1, 2012

 Is there anyway to use LISP to list the x,y coordinates of a pline?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Export GPS Coordinates To CSV?

Dec 7, 2013

I am looking for a method to export all the GPS coordinates which have been assigned to each point along with the properties of that point to an excel csv. In our drawings, there are multiple columns and each column has four points and each point has X,Y,Z coordinates. I want to export all this information to an excel sheet.

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Min Max Coordinates Of A Set Of Lines

Dec 5, 2013

I want to get the minimum and maximum x, y coordinate values of selected lines. In other words, i want to find the top, bottom, left and right edges of a set of lines.

Is it possible to achieve this with a lisp code?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Getting Coordinates Via Listing

Jan 8, 2014

I have created a circle from 3topo points. Im having difficulty getting accurate elevation (z)  of the center of circle (pile representation) via cad polyline listing. im getting same "z" all through out which in fact is not.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Excel Coordinates To Table

Mar 19, 2013

I need to draw a table with point number, easting, northing, elevation for a lot of points and need a lisp to read the xl spreadsheet and draw the table.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Coordinates For Dimension Arrowheads?

Jul 14, 2012

I'm writing function which will facilitate user to offset dimension. After enter command, he select dimension and select point near one of dimension's arrowheads. Then I'm calculating new XLinePoint1 or XLinePoint2 and replacing original.

I have everything done. I thought ... The problem is when user firstly create AlignedDimension and after that he create RotatedDimension by using continous function. After that XLinePoint1 and XLinePoint2 are not parallel to the DimLinePoint (look at image).

How can I get coordinates of points selected in red rectangles?

I know that one is specified as "dimension line defining point" but what about second? How can I get its coordinates?  Or maybe there is other way to get this point?

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Return Coordinates Of LWPOLYLINE

Oct 21, 2013

I recently wrote a lisp routine that was supposed to get the 4 coordinates of a rectangle (LWPolyline).  It worked fine in *MY* tests.  But when someone else ran it, the routine operated as though the order of the points had been rearranged.

How can I get the points AND the order in which they belong?

Here's a sketch to show you what I mean.  As part of my troubleshooting, I had a lisp routine draw a new pline using the points gathered by my first routine.  The result of that on the left.  On the right is the result of that when someone else runs the two routines.

Here's the code I used to get the points.

(defun getplinepointlist(ename)
(setq ent(entget ename))
(setq ptlist (list))
(while (setq pt(cdr(assoc 10 ent)))
[code].......   

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Copy / Move All Entities In Two Coordinates

Jul 16, 2013

I am having nearly 1000 drawings where I need to change the title block in a new format.

I am stuck up in moving all the entities  in  cordinates 15,280 (upper point) and 205,55 (lower Point) to 275,294 (upper point and correspoing lower point.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: List Of Coordinates For View Port

Oct 17, 2011

Is it possible to obtain a list of coordinates for view ports (with dxf codes or otherwise) similar to obtaining a list of (assoc 10) for polylines?

I'm aware I can get the center, width and height from the dxf codes, but what about for clipped view ports with irregular shapes?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Add Attribute To Selected Blocks (XY Coordinates)

Nov 30, 2012

i have found the following lisp in a previous thread: (shows XY coordinates of the selected blocks)

(defun C:MyFunc (/ ss Index Ename Lst)
(while (or (not ss) (= 0 (sslength ss))) (setq ss (ssget '((0 .
"INSERT")))))
(if ss

[Code]....

I want this information to be added to the blocks as hidden attributes so that i can extract them by attout. The work to be done is : attout to excel, autofill an attribute (numbering) then attin.

but my problem is that i cant think of a way to number those blocks IN ORDER (ie top to bottom or left to right) unless by sorting them in excel first by their x or y coordinates

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Zoom Into A Set Of Coordinates Depending On Selection?

Dec 15, 2011

can do a routine that zooms into a coordinate, based on input.  So for 1A, it would zoom into the coordinate for 1A.

1A = 1,1

1B = 1,2

1C = 1,3

1D = 1,4

I will try to attempt one shortly and will post it within 1 hour. 

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Polyline Z Values Not Being Returned By Vla-get-coordinates

Sep 8, 2011

I have a 2 point LWPOLYLINE that has the following coordinates at its end point when I 'ID' the point.

Command: id
Specify point: end
of  X = 709369.3214     Y = 7153039.9690     Z = 269.2143

However if I use..

(vlax-safearray->list (vlax-variant-value (vla-get-coordinates (vlax-ename->vla-object (car (entsel))))))

I get this

(-450567.0 269.288 -450570.0 269.214)

and if I 'dump' the object..

;   Coordinates = (-450567.0 269.288 -450570.0 269.214)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 09855674>
;   Elevation = 7.17399e+006

I don't have a clue where the '-450567.0' is coming from.

I'm in Model Space in 'World' UCS, and I'm confused..  why does the 'ID'd' value not reflect whats going on when I use the vla-get-coordinates approach.

There are many other LWPolylines within the same model that behave normally.

I've attached the drawing (I think!)

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Create Polylines Using Notepad Coordinates

Mar 5, 2013

I have few co-ordinates in notepad like mentioned below. How can i create polyline using read-line function in auto lisp.

x     y
0.0,0.0
2.0,0.0
2.0,1.0
0.0,1.0
2.0,0.0
4.0,0.0
4.0,1.0
2.0,1.0

View 2 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 :: Rounding Up Block Coordinates (insertion Point)

Sep 2, 2013

We have several AutoCAD drawings with hundreds of block references inserted with imprecise coordinates. Now we need to dimension all elements and need to correct these positions.

I am searching for a routine to round these positions up or down towards a 5mm precision so I don't have to manually move every single block element.

Is there any way to automate the task or do you know any workaround (like inserting the elements into a drawing with poorer unit precision settings)?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Explode Mtext - Get X Y Coordinates Of Last Line Of Text

Mar 19, 2012

Would like to be able to select mtext explode it get x y coords of last line of text then turn it back to mtext and then launch mtext at a @0,-0.5  justification TL width 5 and display the ribbon.

All seems to work except the (command ...)

Below is my attempt.

(prompt "Select Note")
(setq ss (ssget))
(command "explode" ss)
(setq ss (ssget "l")) ;get last line of text

(setq ent (entget (ssname ss 0))
ent1 (cdr (assoc 10 ent))) ;get x y coords
(command "undo" "1") ;set exploded mtext back to mtext
(setvar "lastpoint" ent1)

(command "mtext" "@0,-0.4" "j" "TL" "w" "5")

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Blocks At XYZ Coordinates And X / Y And Z Scales From ASCII

Sep 14, 2013

I found this LISP code that can insert a block at coordinates from an ASCII.
 
(defun c:universal( / file f a osmode);PointsToBlocks(while (not file)(setq file (getfiled "Input file" "coords" "txt" 4)))(setq f (open file "r")osmode (getvar "OSMODE"))(setvar "OSMODE" 0)(while (setq a (read-line f))(command "._insert" "block1" a 1 1 0))(setvar "OSMODE" osmode)(princ)

What I want to be able to do is insert blocks from an ASCII and also set the x-, y-, and z-scales.

For example, I have these lines in ASCII, the data points refer to X position, Y position, Z position, X scale, Y scale, and Z scale.

30.593589,21.274607,26.235255,0.172826,0.766324,0.066442
30.710182,21.379792,27.054248,0.130816,0.700035,0.043114

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Selecting Multiple Objects To Export Their Coordinates And ID

May 24, 2013

I am just starting learning lisp, And I am looking for a fast way to select multiple objects (usually circle) and export their coordinates and ID into a excel sheet through lisp programming.

As you might see in the attached drawing, the red circles are objects wanted. I have been trying to export their coordinates as well as their IDs in grids, e.g D28, Easting:  Northing:  . I still haven't found a good way to export ID for each circle.

As my code doesn't work, I wonder what's the most effective way to detect errors in lisp

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Z Value For Points?

Jan 5, 2012

I have a drawing that has 2D pipeline (only x and y, z value =0) and 3 topo contour lines ( with x, y and z vaules). I need to divide the the 2D pipeline into say 2000 points and then get the corresponding z values from the topo contour lines. I think it can be done by interpolating between the z values for the two apparent intersection points of the 2D line and the contour lines, the x and y values will be the same for the points that falls between these two aparent intersections. Is there any lisp out there that can do that.

View 7 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 :: Read Excel File To Insert Text Values At Coordinates

Mar 6, 2013

I got a new work and get it done in the next 2 days, but first I need to do this... from a text file (or excel file, I got both) I got 3 columns, 1 one for node number, and 2 other for X and Y coordinates for each node.

So from that file I need to insert into autocad the node numbers as text (using the current style and height) at the point specified by the other two columns, that are the X,Y coordinates which will be the insertion point of text..

View 5 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 :: Circles At Line End Points?

Feb 2, 2012

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.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Get Corresponding Z Value For Say About 2000 Points On Pipeline

Dec 19, 2011

What I have is a topo plan in 3D (All contour lines have x, y and z values). My pipeline is on x and y coordinate only. I need to get the corresponding z value for say about 2000 points on the pipeline.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Surface Angle With 4 Points

Nov 6, 2013

I need very very often to know the angle between two surfaces to write cnc programms...At the moment i draw allways two lines normal to the line between the two surfaces an use then the angle measuring tool.Works good, faster then bks and dimensioning, but need also time and always need to delete the lines after...

Is it possible to get a lisp which ask für 1 point on the first surface, 1 point on the other surface and two points on the line between the 2 surfaces? So the lisp know 3 points of each surface and can give out the angle between... Should be allways between 0-180°

So it needs only 4 klicks to get a angle! That would be so great! Is there a lisp programmer who can make this possible?

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Use It For Drawing Lines Between Two Points

Aug 19, 2013

how to use AutoLISP to draw lines between two points. I have x,y,z coordinates for the end points in an excel sheet which I can save as a text file. I need to pull the coordinates from the file and use them to draw the lines. There are 2000+ lines so it is not feasible to draw them manually.

View 8 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Dimension Between Two Points In A Selection Set

Nov 1, 2011

Looking to make a selection set of points that are on a specific layer, and then create a dimension between, in this case, two points. I feel like it should be very simple, but I can't get it to work for the life of me. Here is the test code I've been playing around with:

(defun c:test (/ sel1 TC)
(setq sel1 (ssget "X" '((8 . "VPOINTS"))))
(setq TC (polar (entget (assoc 10 (ssname sel1 0))) (dtr 180.0) 9))
(command "DIMLINEAR" (entget (assoc 10 (ssname sel1 0))) (entget (assoc 10 (ssname sel1 1))) "V" (polar TC (dtr 180.0) 9) "")
[code].......

View 1 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Finding 2 Points Along A Pline

Jul 7, 2013

I have plines of circuits that sometimes have T's (line goes along, then T's out then back to T point and then continues).

Here is example line -

(setq List_Pline (list (list 0 0) (list 1 1) (list 0.5 1.5) (list 1 1) (list 2 2) (list 3 3) (list 3.5 2.5) (list 3 3) (list 4 4)))

nth 0 = (0 0)
nth 1 = (1 1)     - T point
nth 2 = (0.5 1.5)
nth 3 = (1 1)     - T return point
nth 4 = (2 2)
nth 5 = (3 3)     - T point
nth 6 = (3.5 2.5)
nth 7 = (3 3)     - T return point
nth 8 = (4 4)

I need to be able to pick 2 points along the line and find the shortest route.

Examples - 

1st point at 1,1 and 2nd point at 3,3 - new line is nth's 3,4,5

1st point at 0,0 and 2nd point at 1,1 - new line is nth's 0,1

1st point at 2,2 and 2nd point at 3,3 - new line is nth's 4,5

1st point at 3,3 and 2nd point at 4,4 - new line is nth's 7,8

1st point at 0,0 and 2nd point at 3,3 - new line is nth's 0,1,2,3,4,5

1st point is 1,1 and 2nd point is 1,1 - new line is nth's 1,2,3

I've tried using vlax-curve-getParamAtPoint, but it returns 1st T point.

Synopsis of program -

Select Pline

Pick 1st point

check if on line

Pick 2nd point

check if on line

check if 2nd point is before 1st point, if so swap locations

find last nth of 1st point

find 1st nth of 2nd point

return list

View 6 Replies View Related







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