Hello,
I seem to be running into a research problem, most of the stuff I found have elements of what I'm looking for but sometimes I just don't know the names of things to go about doing stuff. This is an example.
I want to leverage the Modify Tab in the same way that normal commands do. In my custom scenario I'd like this work flow:
Step 1: I select an object to process my command - Model/Group/whatever
Step 2: It opens up the modify tab and then I can use the modify commands - preferably even filter them - so I can do things like "Draw line/Select a line from a model" and use that line in my custom command.
Step 3: finish execution.
It seems like this would be simple, but I am unable to do it, and I may just not know the right classes to do this in.
Angel
Hello,
I seem to be running into a research problem, most of the stuff I found have elements of what I'm looking for but sometimes I just don't know the names of things to go about doing stuff. This is an example.
I want to leverage the Modify Tab in the same way that normal commands do. In my custom scenario I'd like this work flow:
Step 1: I select an object to process my command - Model/Group/whatever
Step 2: It opens up the modify tab and then I can use the modify commands - preferably even filter them - so I can do things like "Draw line/Select a line from a model" and use that line in my custom command.
Step 3: finish execution.
It seems like this would be simple, but I am unable to do it, and I may just not know the right classes to do this in.
Angel
One possible approach might be to launch the built-in Revit command by calling PostCommand:
It really depends on what exactly you wish to achieve.
You need to complete all your add-in functionality before calling PostCommand. On ce you call it, you hand over to Revit and the complete original Revit UI, e.g., the modify tab.
It makes sense to explore exactly what functionality is already present in the Revit UI that you can make use of. The API is mostly a wrapper for that. Avoid reinventing the wheel... launching the modify tab is a good way to go.
One possible approach might be to launch the built-in Revit command by calling PostCommand:
It really depends on what exactly you wish to achieve.
You need to complete all your add-in functionality before calling PostCommand. On ce you call it, you hand over to Revit and the complete original Revit UI, e.g., the modify tab.
It makes sense to explore exactly what functionality is already present in the Revit UI that you can make use of. The API is mostly a wrapper for that. Avoid reinventing the wheel... launching the modify tab is a good way to go.
Thank you, I had considered the PostCommand before, but I wasn't sure how to use it. What I envision is something as so - I was working off of the tutorials from AutoDesk, and I wanted to extend it so that it can copy along a line that I either create or select. My issue is I wanted to be able to create lines in the same way you would, say, create a Wall using lines or select a line based off of geometry of another wall.
I'm looking through the list given here:
https://thebuildingcoder.typepad.com/files/commandids.txt and searched for Modify commands, but I suspect I'll need to use something different.
I also was reading somewhere that I might need a sketch plane to do this - I'll need to locate an example for this, since what I am trying to do only makes sense in a planar way (the way Profiles are drawn, as an example). I imagine I would need to do this if I wanted to extend the copy functionality not to be just on a floor plan, but on an elevation as well.
I'm wondering, would I need to combine these two ideas together?
I'm going to spend some time tomorrow reading through the blog posts and see if I can come up with something.
Thank you, I had considered the PostCommand before, but I wasn't sure how to use it. What I envision is something as so - I was working off of the tutorials from AutoDesk, and I wanted to extend it so that it can copy along a line that I either create or select. My issue is I wanted to be able to create lines in the same way you would, say, create a Wall using lines or select a line based off of geometry of another wall.
I'm looking through the list given here:
https://thebuildingcoder.typepad.com/files/commandids.txt and searched for Modify commands, but I suspect I'll need to use something different.
I also was reading somewhere that I might need a sketch plane to do this - I'll need to locate an example for this, since what I am trying to do only makes sense in a planar way (the way Profiles are drawn, as an example). I imagine I would need to do this if I wanted to extend the copy functionality not to be just on a floor plan, but on an elevation as well.
I'm wondering, would I need to combine these two ideas together?
I'm going to spend some time tomorrow reading through the blog posts and see if I can come up with something.
So I'm exploring the PostCommand function. My code is as follows
RevitCommandId id_sketch2D = RevitCommandId.LookupCommandId("ID_SKETCH_2D_PATH");
var binding = uiapp.CreateAddInCommandBinding(id_sketch2D);
uiapp.PostCommand(id_sketch2D);
I get an error:
The commandId must be in Autodesk.Revit.UI.PostableCommand or an external command.
Parameter name: commandId
According to the list here:
https://thebuildingcoder.typepad.com/files/commandids.txt it shows up as 33663.
However, I did notice when I looked at PostableCommand enum - 33663 is not there. Was this removed? If so, does that mean that being able to do this is no longer supported?
I'm currently seeing if something within the PostableCommand enums work.
So I'm exploring the PostCommand function. My code is as follows
RevitCommandId id_sketch2D = RevitCommandId.LookupCommandId("ID_SKETCH_2D_PATH");
var binding = uiapp.CreateAddInCommandBinding(id_sketch2D);
uiapp.PostCommand(id_sketch2D);
I get an error:
The commandId must be in Autodesk.Revit.UI.PostableCommand or an external command.
Parameter name: commandId
According to the list here:
https://thebuildingcoder.typepad.com/files/commandids.txt it shows up as 33663.
However, I did notice when I looked at PostableCommand enum - 33663 is not there. Was this removed? If so, does that mean that being able to do this is no longer supported?
I'm currently seeing if something within the PostableCommand enums work.
First research a manual solution to your task through the UI. Then, look at the Revit journal file. That ought to tell you which command to launch, and its id.
First research a manual solution to your task through the UI. Then, look at the Revit journal file. That ought to tell you which command to launch, and its id.
Can't find what you're looking for? Ask the community or share your knowledge.