Tharwat Posted May 22, 2012 Share Posted May 22, 2012 @ Tharwat: Why even bother checking if the object is a line? Just use (vlax-curve-getDistAtParam (vlax-curve-getEndParam )) for all selected objects. Thanks Alanjt . Actually , that 's why I used these tow functions to avoid converting entities to vla-objects to use vla-get-length or Arclength , but that did not work with lines which caused me to convert them to vla and keep the two vlax-**** functions for the rest of the entities . OMG , I just tried the vlax-*** functions and they do work !!! maybe I was in a hurry that kept things away from my availability . Than you Quote Link to comment Share on other sites More sharing options...
alanjt Posted May 22, 2012 Share Posted May 22, 2012 Thanks Alanjt . Actually , that 's why I used these tow functions to avoid converting entities to vla-objects to use vla-get-length or Arclength , but that did not work with lines which caused me to convert them to vla and keep the two vlax-**** functions for the rest of the entities . OMG , I just tried the vlax-*** functions and they do work !!! maybe I was in a hurry that kept things away from my availability . Than you Regardless of what the documentation says, the vlax-curve* functions will accept enames and vla-objects. Also, they will process enames faster than vla-objects. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 22, 2012 Share Posted May 22, 2012 Yes that was my first intention , when vlax-*** did not work for me with lines at the beginning which made me to use distance function to get the lengths of lines , but now after trying it for a few times , i would never forget this valuable issue . Thank you alanjt and so happy to see your posts after a while of your absence . Quote Link to comment Share on other sites More sharing options...
irneb Posted May 23, 2012 Share Posted May 23, 2012 Also, they will process enames faster than vla-objects.Exactly! The vlax-curve-* functions are C++ routines working with ObjectARX libraries, which in turn work directly with enames as Object References. To use the ActiveX object (vla-object) means that those functions need to convert the vla-object back to an ename Object before it can actually perform anything on it. The vlax-curve-* functions seem to be mis-named, they should have been vl-curve-*, they're not written as ActiveX (i.e. there shouldn't be ax). You can actually see the same thing if you work with DotNet's LispFunction. There the difference is that you cannot use vla-objects at all, you simply pass the ename from lisp and it becomes a drawing object, conversely sending a drawing object back to lisp it comes out as an ename. Quote Link to comment Share on other sites More sharing options...
fathihvac Posted June 1, 2012 Author Share Posted June 1, 2012 Hello, I want to create the list Layers ((setq Layers '("Layer1" "Layer2" "Layer3")) by picking many objects in the drawing to get their layers .For example : I picked objects and i got the following: "Flex300" "Duct400x200" "Flex300" "Insulated250" I want to sort them alphabetecally and remove the douplicates. Thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 1, 2012 Share Posted June 1, 2012 Example: (defun c:test ( / i l r s ) (if (setq s (ssget)) (repeat (setq i (sslength s)) (setq l (cdr (assoc 8 (entget (ssname s (setq i (1- i))))))) (if (not (member l r)) (setq r (cons l r)) ) ) ) (if r (acad_strlsort r)) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 1, 2012 Share Posted June 1, 2012 Hello,I want to create the list Layers ((setq Layers '("Layer1" "Layer2" "Layer3")) by picking many objects in the drawing to get their layers .For example : I picked objects and i got the following: "Flex300" "Duct400x200" "Flex300" "Insulated250" I want to sort them alphabetecally and remove the douplicates. Thanks That's completely out of the thread , so it is better to start a new thread for the next time . OK ? Anyway , Here is an example . (while (setq obj (car (entsel "\n Select object :"))) (if (not (member (cdr (assoc 8 (entget obj))) layers)) (setq layers (cons (cdr (assoc 8 (entget obj))) layers)) ) ) (print (acad_strlsort layers)) Quote Link to comment Share on other sites More sharing options...
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.