FamilyInstance fails to properly locate instance

FamilyInstance fails to properly locate instance

dirk.neethling
Advocate Advocate
422 Views
3 Replies
Message 1 of 4

FamilyInstance fails to properly locate instance

dirk.neethling
Advocate
Advocate

I have a XYZ coordinate, pnt, with the value

 

+  pnt {(0.000000000, 0.000000000, -9.842519685)} 

 

where I want to locate a FamilyInstance. When I run

 

fiSegment = doc.Create.NewFamilyInstance(pnt, segmentSymbol, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

 

 

the instance is located at XYZ={0,0,0} instead of pnt.

 

 

When I try to correct this using the code below, the result is that the element is now located at

 

+  segment_pnt {(0.000000000, 0.000000000, -19.685039370)} 

 

What am I doing wrong?

 

segment_referencePoint = doc.GetElement(fiSegment.Id) as ReferencePoint;

segment_locpnt = fiSegment.Location as LocationPoint;

segment_pnt = segment_locpnt.Point;

//move segment to where the ring is

trans1 = pnt - segment_pnt;

XYZ location = app.Create.NewXYZ(0, 0, pnt.Z);

ElementTransformUtils.MoveElement(doc, fiSegment.Id, location);

//doc.m.Move(items[i], app.Create.NewXYZ( 0, 0, elevations[i]));

segment_referencePoint = doc.GetElement(fiSegment.Id) as ReferencePoint;

segment_locpnt = fiSegment.Location as LocationPoint;

segment_pnt = segment_locpnt.Point;

 

 

dirk

0 Likes
423 Views
3 Replies
Replies (3)
Message 2 of 4

Revitalizer
Advisor
Advisor

Hi Dirk,

 

in the Family file, is the BuiltInParameter.FAMILY_WORK_PLANE_BASED parameter enabled ?

"Arbeitsebenenbasiert" in German.

If so, you can use the FamilyInstance's BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM to adjust the elevation over the work plane.

Its German display name is "Versatz".

 

 

Revitalizer

 

Edit:

If your Family is not work plane based, the FamilyInstance's offset parameter is meaningless.




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 4

dirk.neethling
Advocate
Advocate

Thanks Revitalizer,

 

I managed to set both BuiltInParameters in the FamilyDocument and instance respectively.

 

Can I now utilise the following methods?

 

ElementTransformUtils.MoveElement

ElementTransformUtils.RotateElement

 

Using them to manipulate a FamilyInstance does not seem to yield the same results as using them to modify an instance of an Adaptive  model, obtained from ,

 

AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance(doc, symbol);

 

When I run These methods over the Family instance, the resulting Position and orientation of that instance is different to the instance created using the AdaptiveComponentInstanceUtils class.

 

regards, dirk

 

0 Likes
Message 4 of 4

dirk.neethling
Advocate
Advocate

The familyInstancenNeeds to be rotated about all 3 axes, and around ist center axis.

When I use plane-based Elements it Fails. Even when I use the template "M_Mechanische Geräte.rft", and uncheck the BuiltInParameter FAMILY_ALWAYS_VERTICAL, it fails. It seems that in Revit it is impossible to instantiate and then rotate an Element around the 3 axis of a coordinate System. There is always something illogical at Play.

0 Likes