Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Help with a lisp : Lenght Of Object
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Help with a lisp : Lenght Of Object (Read 1403 times)
0 Members and 1 Guest are viewing this topic.
PM
Guest
Help with a lisp : Lenght Of Object
«
on:
December 06, 2020, 03:21:26 AM »
I have this code to dimension lines. arc,polylines . The problem is that calculate the full length. So when i have 4 points on an arc or on a polyline i can not find the distance between them. I want to ask if it possible to make this lisp work like this
1) select the object (so understand if it is a polyline ,or line or acr etc...)
2) give as the otion to hit ender and calculate all the distanse or
3) give as the option to pick 2 points and aclulate the dinstanse from this area only
Code - Auto/Visual Lisp:
[Select]
(
defun
LenghtOfObject
(
obj
/
len
)
(
if
(
vl-catch-all-error-p
(
setq
len
(
vl
-
catch
-
all
-
apply
'
vlax-curve-getDistAtParam
(
list
obj
(
vl
-
catch
-
all
-
apply
'
vlax-curve-getEndParam
(
list
obj
)
)
)
)
)
)
nil
len
)
)
;------------------------------------------------ c:LengthText ----------------
(
defun
c:LineDimAnnot
(
/
*
ModelSpace
*
sel
)
(
command
"_.-layer"
"_make"
"_dimension"
"_color"
93
""
"_lweight"
0.30
""
""
)
(
command
"_.-style"
"_diast"
"wgsimpl.shx"
"_annotative"
"_yes"
"_no"
1.75
1.0
0.0
"_no"
"_no"
"_no"
)
(
vl-load-com
)
(
setq
*
ModelSpace
*
(
vla-get-ModelSpace
(
vla-get-ActiveDocument
(
vlax-get-acad-object
)
)
)
)
(
setvar
"errno"
0
)
; when the user on ssget press Enter the errno is set to 52
(
while
(
and
(
setq
sel
(
ssget
)
)
(
/=
(
getvar
"errno"
)
52
)
)
(
if
sel
(
progn
(
mapcar
(
function
(
lambda
(
ent
/
obj olg stpt endpt next_pt midpt TxtObj midpt1
)
(
setq
Obj
(
vlax
-
ename
->
vla-object
ent
)
)
(
if
(
and
(
setq
olg
(
LenghtOfObject obj
)
)
(
>
olg
0
)
)
(
progn
(
setq
stpt
(
vlax-curve-getStartPoint
obj
)
)
(
setq
endpt
(
vlax-curve-getendpoint
obj
)
)
(
setq
midPt
(
vlax-curve-getPointAtDist
obj
(
*
olg
0.5
)
)
)
(
setq
midPt1
(
polar
midPt
(
+
(
*
0.5
pi
)
(
angle
stpt endpt
)
)
1e
-
3
)
)
(
setq
TxtObj
(
vla-addText
*
ModelSpace
*
(
rtos
olg
2
2
)
(
vlax-3d-point
midpt
)
(
*
(
/
1
.
(
getvar
'cannoscalevalue
)
)
1.75
)
)
)
;_ end of vla-addText
(
vla-put-Rotation
TxtObj
(
+
(
*
1.5
pi
)
(
angle
(
vlax-curve-getClosestPointTo
obj midpt1
)
midpt1
)
)
)
(
setq
midpt
(
vla-get-InsertionPoint
TxtObj
)
)
(
vla-put-alignment
TxtObj acAlignmentBottomCenter
)
(
vla-put-TextAlignmentPoint
TxtObj midpt
)
)
(
if
(
ssmemb
ent sel
)
(
ssdel
ent sel
)
)
)
)
)
(
vl
-
remove
-
if
-
not
'
(
lambda
(
x
)
(
=
(
type
x
)
'ENAME
)
)
(
mapcar
'
cadr
(
ssnamex
sel
)
)
)
)
)
)
)
;change layer to 0
(
mapcar
'
setvar
'
(
clayer cecolor celtype celweight
)
(
list
"0"
"BYLAYER"
"BYLAYER"
-
1
)
)
(
princ
)
)
Thanks
Logged
BIGAL
Swamp Rat
Posts: 1420
40 + years of using Autocad
Re: Help with a lisp : Lenght Of Object
«
Reply #1 on:
December 07, 2020, 01:29:23 AM »
Over at forum\autodesk kent1cooper has some very good dim pline etc may be what your looking for.
Logged
A man who never made a mistake never made anything
JarvisDashiell
Mosquito
Posts: 2
Re: Help with a lisp : Lenght Of Object
«
Reply #2 on:
December 17, 2020, 11:34:33 PM »
Logged
แทงบอล
ดูบอลสดฟรี
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Help with a lisp : Lenght Of Object