TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: efernal on April 02, 2008, 12:01:20 PM
-
I have some dwg files with splines that does not return area and perimeter with AutoCAD AREA command.
I can get the area value with VLAX-CURVE-GETAREA, but do not find how to get the perimeter...
Any ideas?
thanks,
e.fernal
-
A bit more...
This spline entity returns area and circumference
-> Selecione entidade < 1 > :
SPLINE Layer: "Camada 1"
Space: Model space
Color: 7 (white) Linetype: "BYLAYER"
Handle = 2e
Area: 251.0456
Circumference: 88.7003
but this one does not (look Area: -1.0000)
however, circumference is ok...
-> Selecione entidade < 1 > :
SPLINE Layer: "Camada 1"
Space: Model space
Color: 7 (white) Linetype: "BYLAYER"
Handle = 8d
Area: -1.0000
Circumference: 1153.2008
Order: 4
Properties: Planar, Non-Rational, Periodic
Parametric Range: Start 0.0000
End 1.0000
So, the code bellow retrieves the area, even negative
(VLAX-GET-PROPERTY
(VLAX-ENAME->VLA-OBJECT (CAR (ENTSEL)))
'area
)
-1.0
But could not retrieve the circumference
(VLAX-GET-PROPERTY
(VLAX-ENAME->VLA-OBJECT (CAR (ENTSEL)))
'circumference
)
; error: ActiveX Server returned the error: unknown name: CIRCUMFERENCE
What I need is just the circumference of this spline...
e.fernal
-
Have you tried this?
(vlax-curve-getdistatparam curve-obj (vlax-curve-getendparam curve-obj))
-
Hi,
To get the perimeter:
(vlax-curve-getDistAtParam spline (vlax-curve-getEndParam spline))
Just too slow...
-
I will try...
Thanks...
e.fernal
-
This teste works perfectly, thanks for the help...
(DEFUN c:teste (/ curve-obj dist)
(VL-LOAD-COM)
(WHILE (SETQ curve-obj (CAR (ENTSEL "\n-> Selecione objetos...")))
(SETQ dist
(VLAX-CURVE-GETDISTATPARAM
(VLAX-ENAME->VLA-OBJECT curve-obj)
(VLAX-CURVE-GETENDPARAM (vlax-ename->vla-object curve-obj))
)
)
(PRINT dist)
)
(PRINC)
)
e.fernal