Jump to content

Selecting Dynamic Blocks and Activating Action Parameters.


Recommended Posts

Posted

Is it possible to select dynamic blocks and activate action parameters...  similar to Shift+left click on block grips?


(defun c:foo ()
  
  (vl-load-com)  

  (setq ssTestSet (ssadd))
  
  (princ "\nSelect Test block(s): ")
  (setq ss (ssget '((0 . "INSERT")(2 . "`*U*"))))

  (if ss 
    (progn
      (setq ssTestBlocks '())
      (setq i 0)
      (repeat (sslength ss)
        (setq blkRef (ssname ss i)
              effname (vla-get-EffectiveName (vlax-ename->vla-object blkRef))
              i  (+ i 1)) 
        (if (= (strcase effname) "TEST")
          (progn
            (ssadd blkRef ssTestSet)
          )
        )
      )

      (if ssTestSet
        (progn 
          (sssetfirst nil ssTestSet)
          ;Add Activate Position1 action parameter Code Here
          ;Similar to Shift+left click on grips
        
        )
        (princ "\nNo blocks named 'Test' were found.")
      )
    )
    (princ "\nNo blocks found with names starting with '*U*'.") 
  )
  (princ)
)

 

foo_ActionParameter.dwgFetching info...

ActionParameters.jpg.44c823c15822145bf97d9fb4418fa67e.jpg

 

The scenario on the right is what I'm looking for.

 

Posted

I don't understand what you're trying to achieve

Posted

I want to grab Postion1 for all the blocks selected and then allow the user to relocate all Positions1 in one go.

 

Animated.gif

Posted (edited)

Ok 1st step is get a copy of this program by Lee Mac, https://lee-mac.com/dynamicblockfunctions.html

 

You want to change the values of Position1_X & _Y, this can be done using Lee's code.

 

;; Set Dynamic Block Property Value  -  Lee Mac
;; Modifies the value of a Dynamic Block property (if present)
;; blk - [vla] VLA Dynamic Block Reference object
;; prp - [str] Dynamic Block property name (case-insensitive)
;; val - [any] New value for property
;; Returns: [any] New value if successful, else nil

(defun LM:setdynpropvalue ( blk prp val )

Also look at LM:getdynpropvalue so get the current value and +- to that value.

 

Have a go if you get stuck we are here.

Edited by BIGAL
Posted

I selected both dumb blocks and dynamic blocks at all of the clickable points. I still don't understand what you speak of by saying

 

"similar to Shift+left click on block grips?".

 

I was curious that I missed out on something, but didn't see anything...

 

Do you have a loaded tool that lets you Shift + left click on a grip that does something that the rest of us don't have?

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