Isaac26a Posted August 12, 2021 Posted August 12, 2021 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. Quote
devitg Posted August 12, 2021 Posted August 12, 2021 (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 Edited August 12, 2021 by devitg add img 1 Quote
Isaac26a Posted August 12, 2021 Author Posted August 12, 2021 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 Quote
Isaac26a Posted August 12, 2021 Author Posted August 12, 2021 This are the ones that give me problems issues.dwg Quote
devitg Posted August 12, 2021 Posted August 12, 2021 find attached get-length+area.LSP length and area.dwg Quote
Isaac26a Posted August 12, 2021 Author Posted August 12, 2021 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 Quote
devitg Posted August 12, 2021 Posted August 12, 2021 Also you can use (vlax-curve-getArea curve-obj) Quote
Isaac26a Posted August 12, 2021 Author Posted August 12, 2021 2 minutes ago, devitg said: Did you test the lisp? Yes, and works pretty fine, thanks. Quote
Isaac26a Posted August 12, 2021 Author Posted August 12, 2021 the one that comes with Autocad the vlispIDE, and that's a reason to not migrate to the latest versions. Quote
devitg Posted August 12, 2021 Posted August 12, 2021 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 ? Quote
Isaac26a Posted August 12, 2021 Author Posted August 12, 2021 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. Quote
BIGAL Posted August 13, 2021 Posted August 13, 2021 (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 August 13, 2021 by BIGAL Quote
Isaac26a Posted August 13, 2021 Author Posted August 13, 2021 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. Quote
Recommended Posts
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.