Jump to content

to make a vl selectionsent


devitg

Recommended Posts

Iterating on a dwg I got the handle of each enty in a list

 

 

(setq handle-por-codigo-list (list "4C432" "4C350" "4C2F9" "4C2F4" "4C2EF" "4C223" ))

After it, I make a enty selection set in lisp by

 

(setq por-codigo-ss (ssadd))

(foreach handle handle-por-codigo-list
      (setq ent-por-handle  (handent handle))   
           (ssadd ent-por-handle por-codigo-ss)    
)

 

 

 

Now I need to populate the variant to be send to the SelectionSet object;

input-only

The name of the selection set.

To be used at

wblock method 

 

I created the new selectionset and add to the selectionsets collection

 

 

(setq nombre "ent-con-codigo")

(if(not (vla-item SelectionSets nombre))
   (setq nueva-ss (VLA-ADD SELECTIONSETS   NOMBRE))
   (progn
   (setq nueva-ss (vla-item SelectionSets nombre))
   );end progn
)

 

Now I need to create the wblock with the NOMBRE selectionset

 

How I do populate the nueva-ss with all the por-codigo-ss

 

Off course I have the

ACAD-obj

ADOC obj

ADOC model space

and the

selectionsets collection.

 

Per this code

(VL-LOAD-COM)
 (SETQ ACAD-OBJ (VLAX-GET-ACAD-OBJECT)) ;_ el programa ACAD 
 (SETQ ADOC (VLA-GET-ACTIVEDOCUMENT ACAD-OBJ)) ;_ el DWG que esta abierto-
 (SETQ MODEL (VLA-GET-MODELSPACE ADOC))
 (SETQ SELECTIONSETS (VLA-GET-SELECTIONSETS ADOC))

 

 

I use this defun to make the wbloc

 

(DEFUN &-WBLOCK/axss-nombre-arch  (AXSS
                 NOMBRE-ARCH
                 /
                 )
 (VL-CATCH-ALL-APPLY
   (FUNCTION
     (LAMBDA ()
       (IF (NOT (ZEROP (VLA-GET-COUNT AXSS)))
         (IF (NOT
               (FINDFILE
                 (SETQ NEWFILE (STRCAT (GETVAR "dwgprefix")
                                       (STRCAT (VL-FILENAME-BASE (GETVAR "dwgname")) NOMBRE-ARCH ".dwg")))))
           (VLA-WBLOCK ADOC NEWFILE AXSS)
           (ALERT (STRCAT "el :\n" "\"" NEWFILE "\"" "\ya existe."))
           )
         (ALERT (STRCAT "No hay nada en la seleccion"))
         ) ;_ si no hay nada en la seleccion
       ) ;_ lambda
     ) ;_ function
   ) ;_ vl-catch-all-apply

 )

 

 

Hope I explain it at all,

Thanks in advance

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