Hi
I try to link a revit file and then bind it in my host project.
I've created my linked instance but can't find a way to bind it..
Here is my code :
_____________________________________________________________________________
string testFile = "C:\\Users\\asabatier\\xxx.rvt";
ModelPath linkpath = ModelPathUtils.ConvertUserVisiblePathToModelPath(testFile);
RevitLinkOptions options = new RevitLinkOptions(false);
tr.Start("Base Vie");
Autodesk.Revit.DB.LinkLoadResult result = RevitLinkType.Create(doc, linkpath, options);
RevitLinkInstance instance = RevitLinkInstance.Create(doc, result.ElementId);
__________________________________________________________________________
I've tried to create a gropu with my link but as it says it creates a group but don't attach my link..
Thanks for your help.
Alexandre
Hi
I try to link a revit file and then bind it in my host project.
I've created my linked instance but can't find a way to bind it..
Here is my code :
_____________________________________________________________________________
string testFile = "C:\\Users\\asabatier\\xxx.rvt";
ModelPath linkpath = ModelPathUtils.ConvertUserVisiblePathToModelPath(testFile);
RevitLinkOptions options = new RevitLinkOptions(false);
tr.Start("Base Vie");
Autodesk.Revit.DB.LinkLoadResult result = RevitLinkType.Create(doc, linkpath, options);
RevitLinkInstance instance = RevitLinkInstance.Create(doc, result.ElementId);
__________________________________________________________________________
I've tried to create a gropu with my link but as it says it creates a group but don't attach my link..
Thanks for your help.
Alexandre
Dear Alexandre,
Thank you for your query.
Is my understanding correct as follows?
First, you can successfully link in the target RVT document into the host document using the code above. It creates a new RevitLinkType object plus other bits and pieces to represent and manage the linked-in file.
Secondly, the built-in Revit command to bind the link is executed afterwards and converts the objects to something else.
Is that correct?
If so, I would suggest that you use RevitLookup and other tools to explore what objects are created, which elements are affected, and exactly how, by the second step in this process.
Maybe the same functionality can be achieved programmatically by your add-in.
Maybe, however, this built-in command does something that is not exposed though the Revit API.
In that case, you might have to drive the existing built-in command programmatically, e.g., by calling PostCommand.
The problem with that is that in many cases you cannot fully automate the user input, if any is required.
Please confirm my assumptions so far and explore further if possible.
I hope this helps.
Looking forward to further discussions on this and finding out how we can solve this.
Best regards,
Jeremy
Dear Alexandre,
Thank you for your query.
Is my understanding correct as follows?
First, you can successfully link in the target RVT document into the host document using the code above. It creates a new RevitLinkType object plus other bits and pieces to represent and manage the linked-in file.
Secondly, the built-in Revit command to bind the link is executed afterwards and converts the objects to something else.
Is that correct?
If so, I would suggest that you use RevitLookup and other tools to explore what objects are created, which elements are affected, and exactly how, by the second step in this process.
Maybe the same functionality can be achieved programmatically by your add-in.
Maybe, however, this built-in command does something that is not exposed though the Revit API.
In that case, you might have to drive the existing built-in command programmatically, e.g., by calling PostCommand.
The problem with that is that in many cases you cannot fully automate the user input, if any is required.
Please confirm my assumptions so far and explore further if possible.
I hope this helps.
Looking forward to further discussions on this and finding out how we can solve this.
Best regards,
Jeremy
I just noticed another thread on this topic, never completed, though, asking:
Does the Revit API provide the bind linked file method?
I just noticed another thread on this topic, never completed, though, asking:
Does the Revit API provide the bind linked file method?
Wow.
I found three more discussions on this topic, all of them lacking a final conclusion:
I am checking with the development team for you now.
Wow.
I found three more discussions on this topic, all of them lacking a final conclusion:
I am checking with the development team for you now.
Hi
Thanks for your answer.
I manage to create my RevitLinkType and to place an instance in my project.
Then I'd like to programmaticaly bind this instance in my project (it should create a group) and then I'll explode that group!
I've never use postcommand so if it's too complicated I'll try another way to do it (without having to play with linked files..).
Hi
Thanks for your answer.
I manage to create my RevitLinkType and to place an instance in my project.
Then I'd like to programmaticaly bind this instance in my project (it should create a group) and then I'll explode that group!
I've never use postcommand so if it's too complicated I'll try another way to do it (without having to play with linked files..).
According to the other discussion threads on this topic, PostCommand may not work for 'bind link', and no known workaround has been mentioned yet, so I would wait first and see what the development team have to say about this...
According to the other discussion threads on this topic, PostCommand may not work for 'bind link', and no known workaround has been mentioned yet, so I would wait first and see what the development team have to say about this...
Dear Alexandre,
Thank you for your patience.
I heard back from the development team; they say:
This is currently not possible through the API. This seems like a good thing for Revit Ideas, especially if so many people are asking for it. Please submit an idea for this to the Revit Idea Station, if there is none there already, and vote for the existing one, if there is. Thank you!
Best regards,
Jeremy
Dear Alexandre,
Thank you for your patience.
I heard back from the development team; they say:
This is currently not possible through the API. This seems like a good thing for Revit Ideas, especially if so many people are asking for it. Please submit an idea for this to the Revit Idea Station, if there is none there already, and vote for the existing one, if there is. Thank you!
Best regards,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.