Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Plines at right angles 2

Status
Not open for further replies.

Firerunner

Civil/Environmental
Dec 30, 2004
49
I was wondering is there a Lisp routine that if you pick two points(devices in my case)it would draw a pline from one point and from the other at right angles to each other fillet the line and export the lenght to a excel file. I don't how the time or the knowledge to do this in LISP myself.

The last time I did anything in Lisp was AutoCAD rel. 10

Thank you
 
Replies continue below

Recommended for you

I'd love to see one pop up here. This is possibly the most capable and diverse ACAD community on the net, and it wouldn't surprise me in the least! However, as most of the ALISP solutions I've seen here tend to solve one discrete need at a time, combining just the particulars you're looking for might not happen right away.

A good bet might be (if you have a development budget) to contract with a LISP coder who can be available from time to time on a professional basis to meet this and other needs as they arise. Search a bit and get a good one, and you won't be sorry. Justify the cost in the usual manner, and management should be open to a little appropriate persuasion! As always, we want to support each other professionally, and this is one good way to do that. After all, you're making some portion of your living doing the part you do well!

Best of luck!

C.Fee
 
I kind of thought it was a tall order but if anyone know of routines that address some of the things I can finish up the rest manually. Until I can find time to learn Lisp in more detail.

Thanks
 
I must not understand the problem, because I see it as a simple calculation. Pick the 2 devices, get the x-y coordinates of each, the "perpendicular distance" is the x difference plus the y difference, less the shortening due to rounding the 90 with a given radius.

..or do the "devices" have an orientation, and the "perpendicular distance" is at 90 degrees to those and not to the x-y axes?
 
I was going to use the XYout Lisp routine you had on the attribute extraction problem I asked about (4-10).Is there a way to modify that routine to do the calculation and send that information to the csv file?
 
Yes, if I understand the desired result...

-would the user select 2 block inserts, and use the insert coordinates as the start/end points?
-do you want a prompt for radius in the "pedit" calculation, or have that built into the routine?
-would you do just one "run" at a time to send to file, or do you want the csv file to keep a running count, each time adding to the file?
-what all info do you want to go the csv file, just the total length? coordinates of each insert? Block name? radius?
 
In the past all I would do is draw a pline from the panel to the first device then to the next device and so on till I reached the end of the circuit. I would then get the distance and enter it into my excel sheet, and I would be done. With new requirements of having to show distance from device to device, it get time consuming to draw a perpendicular pline for each device at their insertion point,then get a distance for each pline.
What I need is to get the perpendicular distance between each device and repeat until I get to the last device. Just like the XYout Routine you did. All I need is the distance. I can open the CSV file copy the information and paste the information on a excel sheet and have another sheet linked to that sheet.
I hope that helped.
I don't actually have to draw the pline between the device i just need the length.
 
I do not know why you cannot
just do it in excel without
drawing it. The math is not
that difficult. Essentially
you are shortening the two
lines by 2 times the radius
and then adding the curve length
which is simply pi/4 x 2 times
the radius.
This gives you the basic equation
of length one plus length two
minus .2147 times the radius.
 
Sorry the equation should read
length one plus length two
minus .4292 times the radius.
 
Well since Firerunner & cfee would see some benefit in this I gave it a go. Let me know if this works/doesn't work for you.

;; Write conduit lengths to file, routed between selected devices
;; CAB April 21 2006
(princ "\nType CONFILe to start")
(defun c:confile ()
(setq PointCount 1
rad 0 ;default radius for conduit bend
Lentype (getvar "LUNITS")
NumDec 2 ;number of decimals/precision to file
file_extn "csv" ;;change "csv" for diff file types
Delim "," ;;change delimeter here
)
(setq dwg_path (getvar "DWGPREFIX")
filename (getfiled "Create File for conduit lengths" dwg_path file_extn 5)
f1 (open filename "w")
)
(princ "\nPick devices in order: ")
(while
(setq EntPick (entsel (strcat "\nPick device " (itoa PointCount) ": ")))
(setq Ename (car EntPick))
(redraw Ename 3)
(setq Edata (entget Ename))
(setq InsPt (cdr (assoc 10 Edata)))
(setq x (car InsPt) y (cadr InsPt))
(if (> PointCount 1)
(progn
(setq xdiff (abs (- x x2))
ydiff (abs (- y y2))
)
(setq xysum (+ xdiff ydiff)
short (* rad (- 2 (/ pi 2)))
xytot (- xysum short)
)
(write-line (strcat "-" (itoa PointCount) Delim (rtos xytot lentype NumDec)) f1)
(princ (strcat "\nLength= "(rtos xytot lentype NumDec)))
)
);if
(setq x2 x y2 y)
(setq PointCount (1+ PointCount))
);while
(close f1)
(princ)
);defun
 
This is exactly what I needed

Thanks VERY much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor