Community
Dynamic Blocks Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynamic Block Toggle Action

10 REPLIES 10
Reply
Message 1 of 11
ajustin
541 Views, 10 Replies

Dynamic Block Toggle Action

Hi,
1. Is their a way to toggle (pressing a certain key) from a dynamic block during insertion command. can we do this in VB?

2. I defined a dynamic block ex. four visibility. When I do ATTEDIT command on the dynamic block, all the attributes are grayed out. what seems to be the problem.

Thanks
10 REPLIES 10
Message 2 of 11
tlindell
in reply to: ajustin

1- Don't know anything about VB, try the VB discussion group.

2-It would help to post a copy of the block to see what is going on exactly.
http://discussion.autodesk.com/thread.jspa?messageID=4898809
Message 3 of 11
ajustin
in reply to: ajustin

I did already send this topic to the vb group discussion.
Message 4 of 11
tlindell
in reply to: ajustin

Sorry, I did not see that you had already. What exactly is it you're trying to toggle during insert?

Also, please post a copy of the block with the greyed out attributes.
Message 5 of 11
Anonymous
in reply to: ajustin

You can toggle dynamic properties using VBA thus:

Option Explicit

Private Sub ScanBlks()
Dim dybprop As Variant, i As Integer
Dim bobj As AcadEntity
For Each bobj In ThisDrawing.ModelSpace
If bobj.ObjectName = "AcDbBlockReference" Then
If bobj.IsDynamicBlock Then
If bobj.EffectiveName = "cirtagleader" Then
dybprop = bobj.GetDynamicBlockProperties
For i = LBound(dybprop) To UBound(dybprop)
If dybprop(i).PropertyName = "Visibility" Then
dybprop(i).Value = "Leader Off"
End If
Next i
End If
End If
End If
Next

End Sub


The above example changes the "Visibility" visibility state of a block "cirtagleader" to "Leader Off" for each insert in the
drawing.

I insert the block, then request attributes for the block. You can use the initget VB equivalent to prompt to change a dynamic
property while getting the attributes. I've written something in lisp to do this, but not in VB. Should be easy enough to do
though:

Insertion point:
Enter Detail Number (or Y to flip line) <4>: y ;;; here user keyed y to flip the dynamic block using code similar to the above.
Enter Detail Number (or Y to flip line) <4>:
Enter Sheet Number :
Message 6 of 11
ajustin
in reply to: ajustin

Hi,
Thanks for your replies.
Regarding th greyed out attributes, I already figured it out.

Regarding the toggle issue. What I want to try is. After a user
will select a block from the toolpalette, as he moves his mouse out from the toolpalette and for ex. right clicking the mouse, in this case he could select (Toggle) which of the defined Dynamic Block he wants to insert (ex. Dynamic Blocks contains...Ball Valve, Plug Valve, Butterfly Valve...etc..
Is this possible?

Thanks again
Message 7 of 11
ajustin
in reply to: ajustin

Hi Allen,

Yes, I've already tried your example code and studied it and it's ok. But I really am trying to achieve is...
For example after a user selected a block from the toolpalette, and as he moves his mouse out from the toolpalette and for ex. right clicking the mouse, in this case he could select (Toggle) which of the defined Dynamic Block he wants to insert (ex. Dynamic Blocks contains...Ball Valve, Plug Valve, Butterfly Valve...etc..
Is this possible?

Thanks
Message 8 of 11
Anonymous
in reply to: ajustin

Probably not without some "customization".
I don't use tool palettes, but you might be able to use a lisp routine instead to insert the block.

wrote in message news:5182801@discussion.autodesk.com...
Hi Allen,

Yes, I've already tried your example code and studied it and it's ok. But I really am trying to achieve is...
For example after a user selected a block from the toolpalette, and as he moves his mouse out from the toolpalette and for ex. right
clicking the mouse, in this case he could select (Toggle) which of the defined Dynamic Block he wants to insert (ex. Dynamic Blocks
contains...Ball Valve, Plug Valve, Butterfly Valve...etc..
Is this possible?

Thanks
Message 9 of 11
Anonymous
in reply to: ajustin

It looks possible to use the visual lisp expression method of adding your block insertion routine to the tool palette menu. That
way you could use the lisp (or VBA) routine to insert and toggle your block at the same time.
Message 10 of 11
Anonymous
in reply to: ajustin

More Info!
If you are using dynamic blocks from the tool palettes, you can set their dynamic properties before insertion, so, yes you can
specify Ball Valve, Plug Valve, Butterfly Valve... in the custom section, but you would have a seperate icon in your tool palette
for each case:
Message 11 of 11
Anonymous
in reply to: ajustin

You could create a VB form that lets the user select different options for
the block. Have it run when the user clicks a tool palette item. Then set
the ok button to insert the block with the desired options already set. It
will require a little coding but I'm sure it can be done.

Thomas

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost

 

”Tips

 

”Services