Author Topic: splines that does not return area/perimeter...  (Read 2642 times)

0 Members and 1 Guest are viewing this topic.

efernal

  • Bull Frog
  • Posts: 206
splines that does not return area/perimeter...
« 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
e.fernal

efernal

  • Bull Frog
  • Posts: 206
Re: splines that does not return area/perimeter...
« Reply #1 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
e.fernal

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: splines that does not return area/perimeter...
« Reply #2 on: April 02, 2008, 12:53:47 PM »
Have you tried this?
Code: [Select]
(vlax-curve-getdistatparam curve-obj (vlax-curve-getendparam curve-obj))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: splines that does not return area/perimeter...
« Reply #3 on: April 02, 2008, 12:54:27 PM »
Hi,

To get the perimeter:

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

Just too slow...
Speaking English as a French Frog

efernal

  • Bull Frog
  • Posts: 206
Re: splines that does not return area/perimeter...
« Reply #4 on: April 02, 2008, 01:54:25 PM »
I will try...
Thanks...
e.fernal
e.fernal

efernal

  • Bull Frog
  • Posts: 206
Re: splines that does not return area/perimeter...
« Reply #5 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
e.fernal