Jump to content

Self intersecting curve (problem in lenght)


Recommended Posts

Posted

Hi friends, I have this small code to select lines or polylines and obtain the length, but it sometimes gives me  this error.

 

Cannot calculate the area of a self intersecting curve.

The code is the following:

(setq poly (car (entsel "\nSelect the polyline\n")))
(setq long nil)
(vl-cmdf "_.area" "_e" poly)
(setq long (getvar "perimeter"))

Do you know a better way to avoid this error.

Posted (edited)

Use the VLA-get-length obj 

 

 

(VL-LOAD-COM)
(SETQ POLY (CAR (ENTSEL "\nSelect the polyline\n")))

(SETQ POLY-OBJ (VLAX-ENAME->VLA-OBJECT POLY))
(SETQ LONG (VLA-GET-LENGTH POLY-OBJ))

 

I did for this poly 

image.png.d96fdf1beaef5091d14bd28d8d679e62.png

 

Edited by devitg
add img
  • Agree 1
Posted
28 minutes ago, devitg said:

Use the VLA-get-length obj 

 


(VL-LOAD-COM)
(SETQ POLY (CAR (ENTSEL "\nSelect the polyline\n")))

(SETQ POLY-OBJ (VLAX-ENAME->VLA-OBJECT POLY))
(SETQ LONG (VLA-GET-LENGTH POLY-OBJ))

 

Thanks devitg you solved a problem I've been carring for a long time, do you have also a command for the area, that also gives me the same answer. my guess would be vla-get-area but I don't have any reference of vla commands.

My problem was with the polyline made of 2 curves (I actually don't see any self-intersecting curve) but that´s what it is.

Do you know if Autodesk has a new pdf of the vla and visual lisp commands as they used to have? because in my really old version the vla-get-lenght doesn't come

example.jpg

Posted
1 minute ago, devitg said:

What acad version do you use?

 

Mostly C3D 2010, but when I cannot read the files I use the 2019

Posted
2 minutes ago, devitg said:

Did you test the lisp?

 

Yes, and works pretty fine, thanks.

Posted

the one that comes with Autocad the vlispIDE, and that's a reason to not migrate to the latest versions.

Posted
31 minutes ago, Isaac26a said:

the one that comes with Autocad the vlispIDE, and that's a reason to not migrate to the latest versions.

Yes , what is the need to lost VLIDE ?  

Posted

I still don't know, it was perfect like it was, yeah, they haven't changed it or improve it for ... I don't know like forever, but it worked just fine. And they just one day decided to take it out. Well I'll keep my old versions unless there is no another option left, but I guess most of the jobs you can do them with a normal version like 2010 - 2015 and some knoledge of lisp.

Posted (edited)

2022 I dont have it but vlide still supported. Me personally use Notepad++ cut and paste and occasionally vlide to only debug when frustrated.

found this

just change the settings 

Visual LISP (VL) IDE - Launched when the LISPSYS system variable is set to 0.

Visual Studio Code - Launched when the LISPSYS system variable is set to 1 or 2.

and you are good to go !

Edited by BIGAL
Posted
1 hour ago, BIGAL said:

2022 I dont have it but vlide still supported. Me personally use Notepad++ cut and paste and occasionally vlide to only debug when frustrated.

found this

just change the settings 

Visual LISP (VL) IDE - Launched when the LISPSYS system variable is set to 0.

Visual Studio Code - Launched when the LISPSYS system variable is set to 1 or 2.

and you are good to go !

Thanks that's good to know for those like me, that are not willing to change.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...