TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: HasanCAD on August 26, 2019, 03:43:43 AM
-
Hi,
I am wondering if there a lisp to do this task
I have a poyline and want to add length for each segment as attached image 1
and the length as image 2
Thanks in advance
-
Like this? http://www.lee-mac.com/intersectionslength.html
-
More routines----------- Length and Area ------------------
Length of Objects by CAB - pick each object & displays
the object type, length & a running total on the command line.
http://www.theswamp.org/index.php?topic=5891.0
http://www.theswamp.org/index.php?topic=5891.msg268984#msg268984
Lengthen Command with Options by CAB - lengthen command
with key press switch from Lengthen to Shorten
http://www.theswamp.org/index.php?topic=23871.0
http://www.theswamp.org/index.php?topic=29270.0 Line Length Calculator by Lee Mac
http://www.lee-mac.com/intersectionslength.html Line Length Calculator by Lee Mac
http://www.theswamp.org/index.php?topic=20345.0 Areas of objects by Mark Thomas
http://www.theswamp.org/index.php?topic=33671.0 Show Total by Andrea
-
CAB may have missed this one also http://www.lee-mac.com/polyinfo.html
Hansancad need the length of the curves also should be dimmed maybe with radial dim.
-
How to avoid if there is a curved part and measure one side of polyine not 2 sides as attached image 2
Thanks in advance
-
You could use inters on the straight segments and remove the segments with bulges > 0. Here is some code to get the apparent intersection of 2 picked segments.
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/need-lisp-please/m-p/8979192#M388932
-
Like Ronjonp copy existing pline, remove bulges, dim this pline then erase new pline, so dims should be in correct places.
Bulge remove fillet r 0 Last Polyline
Now where is that auto dim pline.
-
Like Ronjonp copy existing pline, remove bulges, dim this pline then erase new pline, so dims should be in correct places.
Bulge remove fillet r 0 Last Polyline
Now where is that auto dim pline.
Up to here is OK and can do that
But dim shall measure both sites of Pline
how to delete duplicate dim ?
-
Trying to find some time as the dims are created using the vertices points it will only ever dim once. Need a autodim pline.
Need some more time I need to redo a couple of routines that check a few things like pline direction. So left right are correct.
; dimension a pline from vertices
; does not support bulges
; By AlanH Consulting info@alanh.com.au
; SEP 2019
(defun c:AHpldim ( / lst x y lst2 pt3 pt)
(setq plent (entsel "Pick pline near start end"))
(setq pt (cadr plent) )
(setq obj (vlax-ename->vla-object (car plent)))
(setq pt1 (vlax-curve-getstartpoint obj))
(setq pt2 (vlax-curve-getendpoint obj))
(setq offd (getdist "Enter offset distance "))
(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(setq dir (ah:butts 1 "h" '("Left or right" "Right" "Left")))
(if plent (setq lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))))
(if (< (distance pt pt1)(distance pt pt2))
(setq lst (reverse lst))
)
(setq x 0)
(repeat (- (length lst) 1)
(setq pt1 (nth x lst))
(setq pt2 (nth (+ x 1) lst))
(if (= dir "Right")
(setq pt3 (polar pt1 (+ (/ pi 2.0)(angle pt1 pt2)) offd))
(setq pt3 (polar pt1 (- (angle pt1 pt2)(/ pi 2.0)) offd))
)
(command "Dim" "aligned" pt1 pt2 pt3 "" "exit" )
(setq x (+ x 1))
)
(princ)
)
(c:AHpldim)
-
HasanCad this should do what you want. make sure download Multi radio buttons.lsp
; dimension a pline from vertices
; does not support bulges
; By AlanH Consulting info@alanh.com.au
; SEP 2019
(defun AHpldim (plent / lst pt1 pt2 pt3 pt offd oldsnap dir)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)
(setq pt (cadr plent) )
(setq obj (vlax-ename->vla-object (car plent)))
(setq pt1 (vlax-curve-getstartpoint obj))
(setq pt2 (vlax-curve-getendpoint obj))
(setq offd (getdist "\nEnter offset distance "))
(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (= but nil)(setq but 1))
(setq dir (ah:butts but "h" '("Left or right" "Right" "Left")))
(command "copy" plent "" "0,0" "0,0")
(setvar 'filletrad 0)
(command "fillet" "p" "last")
(setq plent (entlast))
(setq lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent))))
(if (< (distance pt pt1)(distance pt pt2))
(setq lst (reverse lst))
)
(command "erase" plent "")
(setq x 0)
(repeat (- (length lst) 1)
(setq pt1 (nth x lst))
(setq pt2 (nth (+ x 1) lst))
(if (= dir "Right")
(setq pt3 (polar pt1 (+ (/ pi 2.0)(angle pt1 pt2)) offd))
(setq pt3 (polar pt1 (- (angle pt1 pt2)(/ pi 2.0)) offd))
)
(command "Dim" "aligned" pt1 pt2 pt3 "" "exit" )
(setq x (+ x 1))
)
(setvar 'osmode oldsnap)
(princ)
)
(AHpldim (entsel "\nPick pline near start end"))
-
Sorry for late in answer
Thanks BIGAL Great work
HasanCad this should do what you want. make sure download Multi radio buttons.lsp
; dimension a pline from vertices
; does not support bulges
; By AlanH Consulting info@alanh.com.au
; SEP 2019
...
-
Not a problem, happy to help.