How to select a ModelDoc view? (ViewBorder object)

How to select a ModelDoc view? (ViewBorder object)

AVCPlugins
Advisor Advisor
600 Views
4 Replies
Message 1 of 5

How to select a ModelDoc view? (ViewBorder object)

AVCPlugins
Advisor
Advisor

I figured out a way to get a list of objects inside a ModelDoc view. But I can't even debug the code - I can't select a ViewBorder object in the drawing in any way. The Editor.SelectImplied method returns an error status when the view is selected before calling the command. The GetSelection method also returns an error or writes that 1 object is filtered and requires re-selection. Moreover, I even tried to create a selection filter for VIEWBORDER objects. This does not help.
At the same time, if I call SelectImplied on the Idle event, I get an OK status and a view identifier, no problems. That is, the problem occurs only inside methods marked as CommandMethod.
Does anyone know how to bypass this strange limitation? Perhaps there is some secret undocumented flag for CommandFlags?


Plugins for AutoCAD
A>V>C>
AppStore | Facebook | Twitter | YouTube | Blog
0 Likes
Accepted solutions (1)
601 Views
4 Replies
Replies (4)
Message 2 of 5

ActivistInvestor
Mentor
Mentor

The problem wouldn't be limited to methods that are marked with the CommandMethod attribute, as there is nothing peculiar about their execution, other than that by default, AutoCAD executes them in the document execution context.

 

Handlers of the Idle event run in the application context. So, the problem would appear to be related to the execution context, rather than specifically to methods with the CommandMethod attribute.

 

Have you tried adding CommandFlags.Session to your command method, so that it runs in the application context?

0 Likes
Message 3 of 5

AVCPlugins
Advisor
Advisor

I tried it and unfortunately it didn't work. Even with the Session flag, all object selection commands return an error. Perhaps Auodesk programmers made some kind of check that at least some command was running.


Plugins for AutoCAD
A>V>C>
AppStore | Facebook | Twitter | YouTube | Blog
0 Likes
Message 4 of 5

ActivistInvestor
Mentor
Mentor

Are you trying to select the view border or geometry contained in the view?  I don't believe you can select the latter, only the former.

 

What about a simple (entsel) on the command line?  Does that work?

0 Likes
Message 5 of 5

AVCPlugins
Advisor
Advisor
Accepted solution

I have already solved the problem of finding the list of object identifiers displayed by the view. Moreover, I can read both the list of source solids/blocks and the list of 2d curves that are output to the sheet. I can sell the code to those who want it. Expensive :))

All I had to do was fix the sabotage with the ViewBorder selection.

Well, I figured out a way around the problem - I simply ask the user for a point on the layout, and then easily find the ViewBorder under that point among all the paper space objects. ta-da! My command extracts the BOM from objects visible in the ModelDoc view. The ban on working with these ModelDoc views is completely neutralized 😜


Plugins for AutoCAD
A>V>C>
AppStore | Facebook | Twitter | YouTube | Blog
0 Likes