Jump to content

Recommended Posts

Posted

Hello!

Using array command I inserted blocks. Than I made a selection set of those blocks.Now I want to put dimensions in between the insertion points of those blocks.

 

1. How to get info whats in selection set.

2. can I use vla-dump on selection set?

 

Appreciate your help

Posted

You will need to iterate through the entities in the Selection Set and either query the DXF data using entget, or access the properties / methods of the associated VLA-Object by converting the entity to a VLA-Object using vlax-ename->vla-object.

 

There are many ways to iterate through a Selection Set, here are just a few (each will print the entity types of each entity in the set):

 

(defun c:test1 ( / e i s )
   (if (setq s (ssget))
       (repeat (setq i (sslength s))
           (print (cdr (assoc 0 (entget (ssname s (setq i (1- i)))))))
       )
   )
   (princ)
)

(defun c:test2 ( / e i s )
   (if (setq s (ssget))
       (progn
           (setq i -1)
           (while (setq e (ssname s (setq i (1+ i))))
               (print (cdr (assoc 0 (entget e))))
           )
       )
   )
   (princ)
)

(defun c:test3 ( / e i s )
   (if (setq s (ssget))
       (progn
           (setq i 0)
           (repeat (sslength s)
               (print (cdr (assoc 0 (entget (ssname s i)))))
               (setq i (1+ i))
           )
       )
   )
   (princ)
)

(defun c:test4 ( / e s )
   (if (setq s (ssget))
       (foreach e (mapcar 'cadr (ssnamex s))
           (if (eq 'ENAME (type e))
               (print (cdr (assoc 0 (entget e))))
           )
       )
   )
   (princ)
)

(defun c:test5 ( / e s )
   (if (setq s (ssget))
       (while (setq e (ssname s 0))
           (print (cdr (assoc 0 (entget e))))
           (ssdel e s)
       )
   )
   (princ)
)

(defun c:test6 ( / e i l s )
   (if (setq s (ssget))
       (progn
           (setq i 0
                 l (sslength s)
           )
           (while (< i l)
               (print (cdr (assoc 0 (entget (ssname s i)))))
               (setq i (1+ i))
           )
       )
   )
   (princ)
)

  • 4 weeks later...
Posted

Hello it's been a while,

Using array command I inserted blocks. Than I made one block out of these blocks.Now I want to put dimensions in between the insertion points of those blocks.

Whats is a best and easiest way getting insertion points of these blocks.

Visual lisp or autolisp?

Posted
Whats is a best and easiest way getting insertion points of these blocks.

Visual lisp or autolisp?

 

If I've understood that each block is now nested within the main block, you have two options:

 

1) Iterate over the Objects in the Block Definition using vlax-for on the VLA Block Object in the Block Collection.

 

2) Iterate over the Objects in the Block Definition using entnext on the Block Entity in the Block Table.

 

When you have the insertion points of the Block subentities, you will need to transform these points (possibly using a transformation matrix) so that they are relative to the Block Reference (Insert), accounting for rotation and scaling (since the points will be defined relative to the Block Definition at 1:1 scale and zero rotation, with base point at the origin).

Posted

thanks for instant reply

Posted

Hello

Is it possible to have an example of vlax-for usage? lets say to see the insertion points of the nested blocks within a block.

will continue my reasearch about vlax-for for now

Posted
Is it possible to have an example of vlax-for usage? lets say to see the insertion points of the nested blocks within a block.

 

This isn't a short & simple bit of code, so if you wish for me to write the code for you, I would welcome you to contact me through my site and we can discuss it further.

 

Lee

Posted

With all the respect to you Lee, are you saying that it's time to pay for your services?

If there is a guy on internet, who deserved a donation it's you...but I would appreciate a more direct "you know what".

Thank you SuperLee

Posted
With all the respect to you Lee, are you saying that it's time to pay for your services?

If there is a guy on internet, who deserved a donation it's you...but I would appreciate a more direct "you know what".

Thank you SuperLee

 

Thank you for your kind words Qonfire.

 

Indeed, I would need to charge a fee to cover the time required to construct the code.

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