Jump to content

Visibility Parameter with lisp


resullins

Recommended Posts

I have a dynamic block, attached, that has a visibility parameter for the connector type.

 

I also have one visibility state that brings up an attribute so that you can manually edit the connector type for anything non-standard.

 

I also have a little lisp that makes you able to select a whole bunch of blocks, use the command OTHER, enter a connector type, and it will fill in the atrribute for you. Kind of handy and quick for what we do.

 

There's one little thing I'd like to add, though... I'd love it if when you selected blocks, entered OTHER, entered a connector type and pressed enter, it would automatically change the visibility state to the one that has the attribute in it.

 

I hope that makes sense.

Connector.dwg

Link to comment
Share on other sites

So, you want a routine that you can select a group of dynamic blocks, name the visibility state and it will set each to said specified visibility. Is this correct?

Link to comment
Share on other sites

Mostly. I only want it to change the visibility when you enter the OTHER command, and I want it to automatically select the OTHER visibility state.

Link to comment
Share on other sites

In a coding mood...

 

(defun _toVisibilityState (obj visibilityState)
 (if (minusp (vlax-get obj 'IsDynamicBlock))
   (vl-some
     '(lambda (x)
        (if (wcmatch (strcase (vla-get-PropertyName x)) "*VISIBILITY*")
          (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-value (list x visibilityState))))
        )
      )
     (vlax-invoke obj 'GetDynamicBlockProperties)
   )
 )
)


(defun c:Other (/ ss i)
 (if (setq ss (ssget "_:L" '((0 . "INSERT"))))
   (repeat (setq i (sslength ss))
     (_toVisibilityState (vlax-ename->vla-object (ssname ss (setq i (1- i)))) "Other")
   )
 )
 (princ)
)

Link to comment
Share on other sites

Actually, this would make a lot more sense...

 

(defun _toVisibilityState (obj visibilityState)
 (if (minusp (vlax-get obj 'IsDynamicBlock))
   (vl-some
     '(lambda (x)
        (if (wcmatch (strcase (vla-get-PropertyName x)) "*VISIBILITY*")
          (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-value (list x visibilityState))))
        )
      )
     (vlax-invoke obj 'GetDynamicBlockProperties)
   )
 )
)


(defun c:Other (/ ss i o)
 (if (setq ss (ssget "_:L" '((0 . "INSERT") (2 . "`*U*,Connector"))))
   (repeat (setq i (sslength ss))
     (if (eq (if (vlax-property-available-p
                   (setq o (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
                   'EffectiveName
                 )
               (vla-get-effectivename o)
               (vla-get-name o)
             )
             "Connector"
         )
       (_toVisibilityState o "Other")
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

I use the Properties pallette for mass changes to Dynamic Blocks or Attributes. Maybe I'm not understanding what you're actually trying to do.

Link to comment
Share on other sites

As do I. But there are two steps currently, and there only needs to be one. Mostly because my boss HATES the properties pallete. So if I can make this thing work without having the click in 18 places, it would be awesome, cause then my boss wouldn't get annoyed.

 

@alan: Thanks for that!!!! I'll try it out later today... unfortunately, my morning is filled with fixing Engineer #3's shoddy work. I really hate Engineer #3.

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