TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: efernal on April 02, 2008, 12:01:20 PM

Title: splines that does not return area/perimeter...
Post 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
Title: Re: splines that does not return area/perimeter...
Post by: efernal on April 02, 2008, 12:31:55 PM
A bit more...

Code: [Select]

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
Title: Re: splines that does not return area/perimeter...
Post by: CAB on April 02, 2008, 12:53:47 PM
Have you tried this?
Code: [Select]
(vlax-curve-getdistatparam curve-obj (vlax-curve-getendparam curve-obj))
Title: Re: splines that does not return area/perimeter...
Post by: gile on April 02, 2008, 12:54:27 PM
Hi,

To get the perimeter:

(vlax-curve-getDistAtParam spline (vlax-curve-getEndParam spline))

Just too slow...
Title: Re: splines that does not return area/perimeter...
Post by: efernal on April 02, 2008, 01:54:25 PM
I will try...
Thanks...
e.fernal
Title: Re: splines that does not return area/perimeter...
Post by: efernal on April 02, 2008, 02:04:57 PM
This teste works perfectly, thanks for the help...
Code: [Select]
(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