How to access: Include Work Features via API?

How to access: Include Work Features via API?

aelqabbany
Advocate Advocate
629 Views
4 Replies
Message 1 of 5

How to access: Include Work Features via API?

aelqabbany
Advocate
Advocate

Hi,

How can I access this feature via the API? I wasn't able to find the solution in the API reference. It certainly would be easier than using DrawingView.SetIncludeStatus recursively for every workfeature.

Work Features.png

 

Work Features2.png

 

 

 

 

0 Likes
Accepted solutions (2)
630 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor
Accepted solution

Hi @aelqabbany.  I'm not sure if there is a single pre-defined method exposed in the API yet for that one, but I did find a couple command names that sound about right, that you could try executing.  You would just have to select the browser node before executing the command, which could also be done by code.  The following are the two command names I found:

DrawingIncludeIndividualWorkFeaturesCtxCmd

DrawingIncludeWorkFeaturesCmd

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

aelqabbany
Advocate
Advocate
Thank you very much.
DrawingIncludeIndividualWorkFeaturesCtxCmd -> didn't do anything
DrawingIncludeWorkFeaturesCmd -> Opened the Include Work Features popup

Two follow-up questions:
How can I select the browser node in the context of passing it to a command execute?
Also, is there a way to select the Include Work Features options in the code so that no pop-up is required?
0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor
Accepted solution

I was hoping you wouldn't ask that. 😏

The answers to both questions can be hard to state plainly/simply.  So, to help you understand the answer to the first question, I created short iLogic rule, which does that action in a sample drawing I had on hand.  Accessing and working with stuff in the browser pane can be tricky and a pain, but this example worked for me.  In my sample drawing, I had a view named "Top" nested under a view named "Front".  So I cheated and used an iLogic snippet this time to get that second view, by name, directly.  Then I used a few lines of code to get the BrowserNode for that view.  Then got the first child node under that node, which is the model reference.  Then I simply used the DoSelect method of that BrowserNode to select it.  Then I executed that command, followed by the DoEvents call.

Here is the code: (I changed the view name to match the example in the images you posted)

oDDoc = ThisDrawing.Document
oView = ActiveSheet.View("VIEW2").View
oModelPane = oDDoc.BrowserPanes.Item("Model")
oVNode = oModelPane.GetBrowserNodeFromObject(oView)
oViewModelNode = oVNode.BrowserNodes.Item(1)
oViewModelNode.DoSelect
ThisApplication.CommandManager.ControlDefinitions.Item("DrawingIncludeWorkFeaturesCmd").Execute2(False)
ThisApplication.UserInterfaceManager.DoEvents

As for interacting with the options on that dialog...I do not know how to do that by any normal API or iLogic means right now.  The only thing that comes to mind is to use something like SendKeys.SendWait(), which is usually a last resort.  When using that, you must make sure that dialog has top system focus, or else it will be sending those simulated keyboard entries to something else, which could be dangerous/problematic.  Here is a link to one of my contribution posts in which I use that tool.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

aelqabbany
Advocate
Advocate
Thank you very much. That helps a lot.
0 Likes