why can i use this on an ASM enviroment :
But i can not use this:
Solved! Go to Solution.
I really, really loathe StartCommand()...
First off, PartCommandConstants are intended for the Part environment. The fact that you can use it in Assembly and it actually does something is just coincidence. If you look across the various CommandConstants, a lot of common commands have the same numeric value, but not all. For documented Assembly commands, you should use AssemblyCommandConstants. As you are likely aware, it would seem that the various environment CommandConstants are not 100% completely documented as you can clearly call StartCommand() with some int if you know what value to use.
All that said, I ALWAYS look for an alternative approach to StartCommand(). For altering the view, I would point you to SolidEdgeFramework.View.RenderModeType. You can get to the view via Application.ActiveWindow.View. If you'll use that approach, you can forget StartCommand() all together.
Regarding hiding all sketches, I see no reason you couldn't code it yourself. I haven't tried it but it should be fairly easy.
StartCommand() looks so convienent but it's quicksand, for many reasons.
Thanks for the input. very much apperciated. i was thinking along those lines but i wanted to hear it from an expert.
I would like to hear more about your dislike of "StartCommand()" if you have time.
The main issue with StartCommand() is that it is an asynchronous operation. That means that you have no way to know when the command is completed (other than listening for the AfterCommandRun event). When you call StartCommand(), the method returns immediately and your code continues to execute. The command may not have time to complete before your code moves on doing other things.
For example, image that you called a potentially long running command like DetailCommandConstants.DetailDrawingViewsUpdateViews. Your code returns immediately, you save and close the file. There is a good chance that the command did not have time to complete yet you have no way to know for sure.
There are times that using StartCommand() is appropriate. It just needs to be used with caution and as a last resort.