AutoCAD Visual LISP / AutoLISP :: Combining Random Points Into Lines / Vectors

Jun 7, 2012

I'm working on a program that requires me to analyze a series of 3D coordinates (which describe the start and end points of individual lines) and combine those points that are collinear (there are lots of smaller line segments, some of which are co-linear and overlapping in space) into one single line.

how to analyze these points to find out which ones can be combined. For example, I might have 6 lines, 3 are separate and have their own specific orientation, but 3 are overlapping and in the same direction (look as a single line on the screen). I'd like to modify my point list so that it describes 4 lines... (the 3 individual ones and one which combines the 3 overlapping lines).

View 1 Replies


ADVERTISEMENT

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 :: 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 :: Routine To Convert Lines To Points?

Feb 26, 2012

Just going over some old stormwater flows but have some other stuff included in the coordinates I have, is their anyway to convert lines to points?

I know a long way but im just seeing if theres a quick lisp routine that can do it for me?

View 1 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 :: 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 :: 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 :: 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 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

AutoCAD Visual LISP / AutoLISP :: Get End Points Of Invisible Line?

Aug 23, 2013

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 Related

AutoCAD Visual LISP / AutoLISP :: Tangent Line And Pass Through Two Points

Aug 20, 2012

We have a need to select a tangent line/polyline etc and then select two other points we would then like to have the program draw an arc through the two points and yet still be tangent to the initial line/polyline that we picked.  We don't care what the radius is as we believe there is only one solution anyway.  It would be wonderful if we could just use the Arc command and select start>Second Point> then just use the Tangent Osnap but I guess that is out of the question :-)

The only code that I have come across that even resembles this only allows for one point not two (STILL VERY HANDY AND VERY SLICK)

(vl-load-com)
(defun near_vertex_arr (obj / dxf_obj e_next obj_vlax pt_sel par pt_first pt_snd i bulge)
;bruno.valsecchi

[Code]....

How does everyone else hande this?  By they way... I dont care what language it is written in :-)

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Incrementing Pick Points Alphabetically

Aug 8, 2013

I know how to increment pick points numerically (see below). How is it done alphabetically?
 
(defun C:test (/ pt# pt) (setq pt# (getint "
Enter number: ")) (while (setq pt (getpoint "
Specify point: " ))(if (/= pt nil) (progn (command "TEXT" "M" pt "" "" pt#) (setq pt# (1+ pt#)) ) ) ) (princ))

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Missing OSnap Points With PDF Files

Mar 12, 2013

I am using autocad 2013 and importing PDFs into the drawing and recently the OSnap points within the pdf are missing. The PDFs are of floorplans and I was able to measure from wall to wall using endpoints and midpoints. Now I am only able to select the endpoints on the frame of the pdf.

Is there a switch that might have been turned off?

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Remove Duplicate Points From A List?

Aug 5, 2013

I am looking for code to remove duplicate points (xy coords) from a list with a fuzz factor parameter.

View 1 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 :: 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 :: Distance Between Two Points Along The Path Of Polyline

Sep 10, 2012

There are times that I have a really long curb polyline that has both line and arc segments.  I wish to pick two points along that polyline and have it give me the distance between those two points along the path of the polyline.

Do we have this ability natively?  Have I been missing something all this time?  Normally I have to make a copy of the original entity, ... break, break, list erase or undo....

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Draw Line On List Of Points

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

AutoCAD Visual LISP / AutoLISP :: Calculate Points Offset To Pline

Sep 27, 2013

what I am attempting -

Pick a line

Pick a starting point on the line

Pick a ending point on the line

Pick side to offset

create list of offset points

Create a new line with a offset

I think I could do this using brute force, but would prefer a mathematical solution.

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Missing Points While Render Script

Nov 2, 2012

I want tp write my first programm with autolisp. I use Autocad 2012(rus). When I run my script I see that some of points are missed in the autocad. Maybe I do something wrong?

 (setq RB 300)(setq RM 70)(setq N 12)(setq M 11)(setq I 0)(setq J 0)(defun alphai (i) (/ (* (/ (* 360 i) N) PI) 180))(defun gammaj (j) (/ (* (/ (* 360 j) M) PI) 180))(defun XIJ (I J) (* (+ (* RM (cos (alphai I))) RB) (cos (gammaj J))))(defun YIJ (I J) (* (+ (* RM (cos (alphai I))) RB) (sin (gammaj J))))(defun zij (I J) (* RM (sin (alphai I))))(setq I 0)(setq J 0)(setq PT0 (list 0 0 0))(setvar "CMDECHO" 0)(repeatM (repeat N (setq PT (list (XIJ I J) (YIJ I J) (ZIJ I J))) (command "_point" PT) (setq I (+ I 1)) (setq PT0 PT) ) (setq I 0) (setq J (+ J 1)))

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Erase All Points In Specific Layer

Apr 9, 2013

I have a lisp which I use to erase all points in a specific layer.

(defun cPL ()
 (setq ss1 (ssget "x" (list '(0 . "point")'(8 . "Points"))))
 (command ".erase" ss1 "")
 (princ)
)

It is working only if I have the points in the DWG. If there are no points, I receive "Unknow command DPL". Is there anything I can do in order to avoid this error?

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: How To Insert Block To Points Taken From Txt File

Jun 28, 2013

I got this code in a web trawl to insert a block to points taken from a txt file......

its coming back with an error as follows:

; === Top statistic:
; Function definition (with number of arguments): ((C:INSERTBLOCKS . 0))
; Check done.

What does this mean and how can I fix it.

(defun c:insertBlocks (/ txtFile xyData expertVar attreqVar)(setq expertVar (getvar "expert"))
(setq attreqVar (getvar "attreq"))
(setvar "expert" 2)(setvar "attreq" 0)
(setq txtFile (open "c:\cad\textfile.txt" "r")) ;

[Code] ......

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Circles And MText Within Specified Points?

Apr 9, 2012

I am not sure why this is not working.

(setq SelectionSet (ssget "C" Point1 Point2 '((-4 . "<or") (0 . "CIRCLE") (0 . "MTEXT") (-4 . "<or"))))

I want to select circles and mtext within the specified points.

View 2 Replies View Related

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 View Related

AutoCAD Visual LISP / AutoLISP :: Align Block With Two Selected Destination Points

May 13, 2013

I am trying to write a program to align a block with two selected destination points. 
- first the user is prompted to select a lwpolyline of a block entity
- then he is prompted to pick two destination points

I face problem with the sub-routine SegmentPts. It is supposed to return the coordinates of two vertexes on both sides of the picked point on a lwpolyline using entsel. But here in my program, when i am picking a point using entsel on a lwpolyline inside a block entity, it is not returning the two vertexes on both sides of the picked point. In stead, it returns some other points of the selected LWPOLYLINE. Why it is doing so? Where is the problem in my program?

It works fine with my other programs where i pick on a LWPOLYLINE entity. In this particular case, the LWPOLYLINE is inside a Block entity and the program is not returning correct points.

Please check Lisp Program below:

(defun C:alb()
(setq ent1 (entsel "
Pick on one side of LWLINE ofa Block:" ))
(setq ent (nentselp (cadr ent1)))
[code]........

View 9 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Select Node Points / Text That Has Z Value Greater Than E1

Oct 3, 2013

Code to select node points an/or text that has a Z value greater than "E1" and less than "E2". (where E1 and E2 are user input values)

View 5 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert North Block Oriented On Two Selected Points

Sep 19, 2012

I am trying to insert a norht block oriented on two selected points with the following

(defun c:North ( / ss )
 ;Orientate North Symbol
 (setq oldos (getvar "osmode"))
 (setq blk (vlax-ename->vla-object (car (entsel "

[Code] .......

I am not sure how to (a) erase the selected north block, then (b) make the  insert north block in its place bit work.

View 6 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Creating (arrow) Block With Two Points For Positioning And Orientation

Jul 13, 2013

I'm trying to create a model of arrow with which I could place in drawing in any length and orientation I want with lisp. I was imaging to place two point on this arrow and by placing the two points on my drawing, the length and orientation of the arrow would be define.

I'm trying for hours to create it and my grip for polar stretching don't stay still on my arrow (suppose to be on the peak but go far if I stretch it).

View 9 Replies View Related







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