how to get the center of GeometryInstance

how to get the center of GeometryInstance

KM_Yotsuha
Advocate Advocate
480 Views
4 Replies
Message 1 of 5

how to get the center of GeometryInstance

KM_Yotsuha
Advocate
Advocate

I am going to place  pipe Accessories  on locations where there is a cadblock, in order to get the placepoint of familyInstance,I need to get the center of a geometryInstance。

for example,how to computer the center of blue lines in the picture below?

KM_Yotsuha_0-1661150624696.png

 

0 Likes
481 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Two easy points to start from are the family instance location point and the center of the family instance element's bounding box:

  

  

There are other options available that are more complicated, so I would suggest trying the easiest approaches first.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5

KM_Yotsuha
Advocate
Advocate

sorry for my poor English. I don't want to computer the center of a existing family instance, what I want is where to put the newly created familyInstance.

for example,I want to place a pipe accesory according to the cad below.

KM_Yotsuha_0-1661151756962.png

how  can I get the location parameter? the location point is the centre of a geometryInstance

KM_Yotsuha_1-1661151832191.png

 

0 Likes
Message 4 of 5

Omar_Amen
Advocate
Advocate

Hi @KM_Yotsuha,
if you want to get to correct location to place your instances, then you need to relate with the CAD drawing itself,
let me  assume the best case scenario then  your CAD drawing is clean and:
-the pipe accessories are created as CAD blocks
-the pipe accessories are placed on the same layer (i.e. this layer contain only those pipe accessories)
then you can develop an add-in to get the center point of each CAD block on a layer of name "layer_name_example" that located in the CAD drawing that linked in that Revit document.

*hint: I don't know if you can retrieve the locations data using only the Revit API so I think you will need to use the AutoCad API to relate with the Cad drawing 

0 Likes
Message 5 of 5

KM_Yotsuha
Advocate
Advocate

thank you~~ I can use cadblock's location property,but some block's center is not equal to location point.

how can I computer the center point of blocks like the one below? 

KM_Yotsuha_0-1661158857368.png

 

0 Likes