Hello,
I’m trying to programmatically place a dimension on some family Instances in a section view. Let’s assume, that I have some rectangular boxes placed in a wall. The Insertion point of such a box is in its centre.
I want to place a dimension with references to the origins of each box. I know that I can place a dimension using the “doc.Create.NewDimension” method. But I don’t know how to get the correct reference to the centre of the box. When I place the dimensions manually in the Revit model, I can select the reference planes of the centre of the box, but how do I get them using the API?
Any help would be appreciated!
Hello,
I’m trying to programmatically place a dimension on some family Instances in a section view. Let’s assume, that I have some rectangular boxes placed in a wall. The Insertion point of such a box is in its centre.
I want to place a dimension with references to the origins of each box. I know that I can place a dimension using the “doc.Create.NewDimension” method. But I don’t know how to get the correct reference to the centre of the box. When I place the dimensions manually in the Revit model, I can select the reference planes of the centre of the box, but how do I get them using the API?
Any help would be appreciated!
I currently have a need for this functionality also. I've been investigating this and the best I can do so far is to read the references from a dimension added manually in the project from the UI and then use those references to create a new dimension. The UI calls these Shape Handle References but I am unable to find a similar concept within the API.
In an attempt to determine how to get at the family's reference planes from the project I have been extracting anything I can find that contains a reference and dumping the output of Reference.ConvertToStableRepresentation() to see if I can find a match against the references I am reading from the manual dimension.
lets say the stable representations for my dimension references looks like this:
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:0:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:2:SURFACE
I then dump out the same data for any surfaces I can find in the family and get this:
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:78:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:83:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:88:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:91:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:93:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:95:SURFACE
As you can see they match up until what looks to be an index into the family's geometry table just before the reference type designation. I have no idea whether it is even possible to get at the family's reference planes from the project, so far I haven't found them other than by using the above method which is not even close to ideal.
My next step will be to build up a custom stable representation string using any old reference found within the family instance (using the symbol geometry of course) and replace the index value with the correct index (0 and 2 in my case). I will then hopefully convert this into a usable reference using Reference.ParseFromStableRepresentation(). As far as I can tell the index values are similar to ElementIds in that they are stable and unique to the particular document. The code will be directly tied to a particular family though but it's a start and might just get me out of trouble.
Hopefully there's an API supported way to get at these shape handle references and I'm just missing something, as what I'm about to do is an abominable hack to be sure.
Can anyone save me before it's too late?
I currently have a need for this functionality also. I've been investigating this and the best I can do so far is to read the references from a dimension added manually in the project from the UI and then use those references to create a new dimension. The UI calls these Shape Handle References but I am unable to find a similar concept within the API.
In an attempt to determine how to get at the family's reference planes from the project I have been extracting anything I can find that contains a reference and dumping the output of Reference.ConvertToStableRepresentation() to see if I can find a match against the references I am reading from the manual dimension.
lets say the stable representations for my dimension references looks like this:
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:0:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:2:SURFACE
I then dump out the same data for any surfaces I can find in the family and get this:
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:78:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:83:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:88:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:91:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:93:SURFACE
66a421da-90cb-4df2-8efe-c312e4f78aa0-0003d32b:0:INSTANCE:a2177cbb-03d8-4416-a4d8-8ada6fc0165a-0003ebf0:95:SURFACE
As you can see they match up until what looks to be an index into the family's geometry table just before the reference type designation. I have no idea whether it is even possible to get at the family's reference planes from the project, so far I haven't found them other than by using the above method which is not even close to ideal.
My next step will be to build up a custom stable representation string using any old reference found within the family instance (using the symbol geometry of course) and replace the index value with the correct index (0 and 2 in my case). I will then hopefully convert this into a usable reference using Reference.ParseFromStableRepresentation(). As far as I can tell the index values are similar to ElementIds in that they are stable and unique to the particular document. The code will be directly tied to a particular family though but it's a start and might just get me out of trouble.
Hopefully there's an API supported way to get at these shape handle references and I'm just missing something, as what I'm about to do is an abominable hack to be sure.
Can anyone save me before it's too late?
A quick update to say that the above technique was successful, it's not pretty but it works. Just have to do the homework first to find out the index of the reference you want and then you can reliably create the same reference for any instance of that family.
A quick update to say that the above technique was successful, it's not pretty but it works. Just have to do the homework first to find out the index of the reference you want and then you can reliably create the same reference for any instance of that family.
Thanks Scott,
I've tried your method and well, it works (I would never hed thought of this hack). Unfortunately the indices change from family to family (I’ve tested it with some families and I have some 0, 1, 2 and 4). But at least they seem to be stable for each family. I loaded my families into different documents, restarted Revit (and even Windows), and the indices stay the same (I haven’t tried worksharing).
As you say it would be much better to have an API supported way to obtain these references, as one can only hope that the indices of a family never change.
Thanks Scott,
I've tried your method and well, it works (I would never hed thought of this hack). Unfortunately the indices change from family to family (I’ve tested it with some families and I have some 0, 1, 2 and 4). But at least they seem to be stable for each family. I loaded my families into different documents, restarted Revit (and even Windows), and the indices stay the same (I haven’t tried worksharing).
As you say it would be much better to have an API supported way to obtain these references, as one can only hope that the indices of a family never change.
Excellent, glad you've got it working. Wasn't sure if anyone could understand my ramblings 🙂
Excellent, glad you've got it working. Wasn't sure if anyone could understand my ramblings 🙂
Hello,
I have enquired with the engineering team if there is an API to determine the shape handles for family instance. I will get back to you as soon as I learn something useful.
Thanks,
Gopinath
Hello,
I have enquired with the engineering team if there is an API to determine the shape handles for family instance. I will get back to you as soon as I learn something useful.
Thanks,
Gopinath
Hello,
I do not have good news. There is no API to get the references you want (sorry). I have logged a change request with the engineering team and sent you the details.
Thanks
Gopinath
Hello,
I do not have good news. There is no API to get the references you want (sorry). I have logged a change request with the engineering team and sent you the details.
Thanks
Gopinath
Thanks for looking into this. Does the change request you submitted include a method to find the family references by name? Because that would be super awesome!
Thanks for looking into this. Does the change request you submitted include a method to find the family references by name? Because that would be super awesome!
Hello,
Can you please expand on this request? You want to reference the family instance? or the shape handles? If shape handles, you want to reference them by name?
Thanks
Gopinath
Hello,
Can you please expand on this request? You want to reference the family instance? or the shape handles? If shape handles, you want to reference them by name?
Thanks
Gopinath
How I'd wish this was implemented would be that any reference that has its "Is Reference" property set to anything except "Not a Reference" in the family editor would be included within the GeometryElement returned by GetSymbolGeometry.
The included object would have a base type of "GeometryReference" or similar (to hold any of the objects matching the above criteria) with any of the references that also provide the UI shape handles deriving from this class as an object of type "ShapeHandle" or similar.
The "GeometryReference" class should include the following information as a minimum:
Other properties of reference set within the family editor are probably a good idea to include also (Defines Origin, etc.).
In addition to the above, the following method added to the FamilyInstance class would be a great platform to work from:
public Reference FamilyInstance.GetGeometryReference(String referenceName) (return null if not found)
will return the reference to the "GeometryReference" object matching the name string, this could then be passed back into GetGeometryObjectFromReference to get the actual object.
How I'd wish this was implemented would be that any reference that has its "Is Reference" property set to anything except "Not a Reference" in the family editor would be included within the GeometryElement returned by GetSymbolGeometry.
The included object would have a base type of "GeometryReference" or similar (to hold any of the objects matching the above criteria) with any of the references that also provide the UI shape handles deriving from this class as an object of type "ShapeHandle" or similar.
The "GeometryReference" class should include the following information as a minimum:
Other properties of reference set within the family editor are probably a good idea to include also (Defines Origin, etc.).
In addition to the above, the following method added to the FamilyInstance class would be a great platform to work from:
public Reference FamilyInstance.GetGeometryReference(String referenceName) (return null if not found)
will return the reference to the "GeometryReference" object matching the name string, this could then be passed back into GetGeometryObjectFromReference to get the actual object.
Hello,
I have added your comments to a new enhancement request and emailed you separately.
Cheers
Gopinath
Hello,
I have added your comments to a new enhancement request and emailed you separately.
Cheers
Gopinath
Thanks, this would be very helpfull
Thanks, this would be very helpfull
Hello,
If there is nothing else, please go ahead and accept solution so we can close the ADN request as well.
Best Regards
Gopinath
Hello,
If there is nothing else, please go ahead and accept solution so we can close the ADN request as well.
Best Regards
Gopinath
Impatience will not help...
Impatience will not help...
I found this thread roughly ten minutes before making the post, and I found my need for this wishlist item about fifteen before that. If I posted that out of impatience, it would indeed be a serious personal problem.
Mentioning the time that has passed was not impatience. It was a defense of myself for bumping Ken's request for an update.
It's understandable that there will be triage at Autodesk, and that some wishlist items will take years. Is it also alright for us to ask for updates on items if a significant amount of time passes? I would think this would also be beneficial since it could help Autodesk to understand if some items are highly sought after.
Ken's request for an update had no response since February. It's reasonable to assume that the question was not going to be answered if it were left as it was.
If this functionality is coming in one or two upcoming versions of Revit, that's going to change several things for myself, and I assume others too. Out of curiosity, what was the correct course of action?
I found this thread roughly ten minutes before making the post, and I found my need for this wishlist item about fifteen before that. If I posted that out of impatience, it would indeed be a serious personal problem.
Mentioning the time that has passed was not impatience. It was a defense of myself for bumping Ken's request for an update.
It's understandable that there will be triage at Autodesk, and that some wishlist items will take years. Is it also alright for us to ask for updates on items if a significant amount of time passes? I would think this would also be beneficial since it could help Autodesk to understand if some items are highly sought after.
Ken's request for an update had no response since February. It's reasonable to assume that the question was not going to be answered if it were left as it was.
If this functionality is coming in one or two upcoming versions of Revit, that's going to change several things for myself, and I assume others too. Out of curiosity, what was the correct course of action?
Apologies, I was attempting irony. I really need to use more smiley faces...
Apologies, I was attempting irony. I really need to use more smiley faces...
I totally got it Dale. 😉
maybe that just exposes me for one of the beleaguered...
I can't put my project off any longer so will probably be using the vodoo and see if I can make it happen.
I totally got it Dale. 😉
maybe that just exposes me for one of the beleaguered...
I can't put my project off any longer so will probably be using the vodoo and see if I can make it happen.
Can't find what you're looking for? Ask the community or share your knowledge.