Open Dynamic Block Visibility List Programatically?

Open Dynamic Block Visibility List Programatically?

Anonymous
Not applicable
1,066 Views
6 Replies
Message 1 of 7

Open Dynamic Block Visibility List Programatically?

Anonymous
Not applicable

Is it possible to display a dynamic block's visibility list after insertion?

 

For example:

 

- User selects an insertion point,

- I insert a dynamic block reference programmatically,

- Instead of the user clicking the triangular node to pick the required visibility, I open the list and the user simply selects.

 

Just trying to save the user from having to click the node.

 

0 Likes
Accepted solutions (1)
1,067 Views
6 Replies
Replies (6)
Message 2 of 7

_gile
Consultant
Consultant

Hi,

 

You can iterate the DynamicBlockReferencePropertyCollection of the newly inserted block reference to find the DynamicBlockReferenceProperty you want checking its PropertyName. When found, you can call the GetAllowedvalues() method to get the visibility states list.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 7

Anonymous
Not applicable

First off, I should have mentioned that I'm using AutoCAD 2013.

 

I don't want to programatically get the list of property values, I want to display the drop-down list to the user, just as if they'd clicked the drop-down node in AutoCAD.

0 Likes
Message 4 of 7

norman.yuan
Mentor
Mentor

If you can programmatically insert the dynamic block, you can surely present a list of visibility states (or other dynamic properties, fo rthat matter) to user for their to choose one, as one of the step of the execution process of your code.

 

AI'd imagine your code does this:

 

1. Insert the block at given location;

2. pop up a form (modal dilog, so the user is forced to choose a dynamic property in the list), showing a list of the dynamic property.

3. User chooses one (click or Enter/Esc), the dialog goes away and the inserted block shows the dynamic state as the result.

 

The process is nothing special. You just need to make the form more user-friendly for this operation. For example, I'd use a borderless win form, set proper background color (to resemble the dropdown list showing when user clicks the dynamic block's grip); I'd only show the list (labals, readonly textbox...) and present no close/cancel button, and while the default state selected (if use label/textbox as list item, set the selected to different background color), user can click any item or hit enter to accept the selected item to close the form, or hit Esc to close. You may use WPF to make the form look better. You may also want to show the small form near the inserted block. You can use Editor.PointToScreen() to find out the from's screen location with the block's position in AutoCAD.

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 5 of 7

Anonymous
Not applicable

Don't think I'm making myself clear enough.  I'm not trying to display a userform, I want to show the native drop-down list from the dynamic block.

 

I've attached a screenshot to show the type of list in question.

 

So...how can I open the list programmatically?

0 Likes
Message 6 of 7

norman.yuan
Mentor
Mentor
Accepted solution

Then I do not think there is API method exposed for you to call to get that list pops up from your code. 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 7 of 7

owenwengerd
Advisor
Advisor

This looks like a classical case of demanding an answer to your question instead of a solution to your problem. Norman's answer is the latter, and it is the correct solution to your problem.

--
Owen Wengerd
ManuSoft
0 Likes