Jump to content

Help? Total length on every Layer


fathihvac

Recommended Posts

@ 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

Link to comment
Share on other sites

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • Tharwat

    11

  • fathihvac

    6

  • pBe

    5

  • alanjt

    2

Top Posters In This Topic

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.

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

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))
)

Link to comment
Share on other sites

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))

Link to comment
Share on other sites

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...