Jump to content

Recommended Posts

Posted

Is it possible to make a "selection set" of items that match properties contained within VLAX-GET? I'm trying to pull all the same items that have the "Stylename" of either "3D Sizes" or "2D Sizes". If I try to grab based on DXF Group code 0 then it grabs both, and if I then run it thru (VLAX-GET 'Stylename) it will only return only either "3D Sizes" or "2D Sizes" (best guess is returning whichever one was most recently added to the drawing. If its not possible to add all ('Stylename "2D Sizes) to a selection set, then would this be more the job of grabbing all 2D and 3D then running it thru a loop and separating into 2 selection sets that way?

Code I'm using which grabs all using DXF codes then turning from new to existing is:

 (if (/= (setq sset (ssget "_I")) nil)
   (setq hnd (ssname sset 0))
   (setq hnd (car (entsel "\nDS> Select Object Type: ")))
   );if
(setq obj (cdr (assoc 0 (entget hnd))))
(cond ((= obj "AECB_LABEL_CURVE")
       (setq tagobj1 (ssget "_X" (list (cons 0 "AECB_LABEL_CURVE"))))
       (setq num_items (sslength tagobj1))
       (while (< i num_items) ; iterate through each item in the selection set
              (setq tagobj2 (ssname tagobj1 i))
              (setq tagobj3 (vlax-ename->vla-object tagobj2))
              (setq sysname1 (vlax-get tagobj3 'StyleName))
              (setq test (strcat sysname1 " Existing"))
              (vlax-put tagobj3 'StyleName test);1
              (setq i (1+ i)) ; increment the counter
              );while
            );equals
            );cond


 

That works for the 2D Sizes in the selection set, but then it gets stuck in a continuous loop when it comes to the items 3D Sizes. I'd like just skip grabbing dxf info if possible and just grab based on "Stylename", just don't know if thats possible. My explanation could be convoluted, if more clarification is needed just ask. 

Posted

I would just start with 

(setq ss (ssget "_X" (list (cons 0 "AECB_LABEL_CURVE"))))

 

Asking the user to select something to then turn around and make a global selection if they selected the right thing only slows down the process.

 

Id have to see a sample drawing of what your talking about. all you say is "items with 2d and 3d sizes" so I'm not quite sure what entity your talking about. but im sure you could edit the ssget to filter out the ones you don't want.

 

This should do what I think your talking about.

(if (setq ss (ssget "_X" (list (cons 0 "AECB_LABEL_CURVE"))))
  (foreach obj (mapcar 'cadr (ssnamex ss))
    (setpropertyvalue obj "StyleName" (strcat (getpropertyvalue obj "StyleName") " Existing"))
  )
)

 

Posted

Just one question (setq test (strcat sysname1 " Existing")) does the style name exist ? CIV3D is fussy like that. 

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