How to use userinput like "select a sectionplane" in VBA

How to use userinput like "select a sectionplane" in VBA

Anonymous
Not applicable
1,663 Views
7 Replies
Message 1 of 8

How to use userinput like "select a sectionplane" in VBA

Anonymous
Not applicable

I just started programming in VBA. I want to create an interactive code, but sometimes I have to select different objects to execute commands (such as selecting a line to offset, moving a section, ...).

I know how to create a Userform, but I think this is something else than entering values or clicking buttons.

Thank you in advance.

0 Likes
1,664 Views
7 Replies
Replies (7)
Message 2 of 8

Ed__Jobe
Mentor
Mentor

Do you mean that you want to do something like the BLOCK command's dialog has buttons for selecting entities, insertion point and rotation?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 8

Anonymous
Not applicable

Yes, something like a 'select entity' button.

Let's use 'offet a line' as an example. I want the user to be able to decide what line to offset.

0 Likes
Message 4 of 8

Ed__Jobe
Mentor
Mentor

You just have to hide the form while you work with the editor. Here's a sample from one of my forms.

Private Sub cmdPickSpacing_Click()
    Me.Hide
    tbxSpacing = ThisDrawing.Utility.GetDistance(, "Pick first point: ")
    Me.Show
End Sub

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 5 of 8

Anonymous
Not applicable

Ok, but that is just to select a distance between two points, and that is also helpfull.

But how can I select an object/entity instead?

0 Likes
Message 6 of 8

Anonymous
Not applicable

Hey @Ed__Jobe 

 

I just managed to insert the object that I want to select in a unique Layer. Maybe it is easier to select all object from a certain Layer?

 

0 Likes
Message 7 of 8

Ed__Jobe
Mentor
Mentor

See the ActiveX Developer's Reference. There are a whole bunch of GetXXX methods. Here's the GetEntity method.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 8 of 8

Ed__Jobe
Mentor
Mentor

It's best if you state what it is you want to do. Then we can suggest the best way to do it. You could present a drop down list of layers in the current drawing for the user to select from. If you select an entity, it has a layer property you can use.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes