Hey everybody,
I'm trying to make some experience in programming with the Revit Api. I have a bunch of Components (i.e. parts of a chair). Each of this parts is stored in an own family and I load them with the Api. But I have some problems with the correct positioning of the elements. On the one hand i don't know which unit is used if I do a translation(ft, inch, meters..). This is important for me because of the dependency between the elements (the position is relative to other parts). Furthermore I don't really find anything about the used coordinate system which is used if I insert a symbol with placefamilyinstance (sometimes i read Gauss-Krüger-coordinate system). The (for the moment) last question is: Can I insert elements in a direct dependency of another instance, so that the newly placed element is in the context of the local coordiate system? And is this then another type of coordiate system? I read that groups won't work for me, because I can have sometimes group without symbols (only a position) and that I can't change anything in an subgroup.
The objective is to insert all parts, place them correctly and have at the end one complete object at once.
Greetings
Alex
Hi,
answers:
1) The units for distances are always FT, the conversion between mm and FT is: FT = mm / 304.8
2) Are you speaking about the NewFamilyInstance command? If you use it, for example:
var instance = document.Create.NewFamilyInstance(new XYZ(0,0,0), familySymbol, StructuralType.NonStructural);
you will place an instance in the Origin (0,0,0) and you will have an Element object that usually is of FamilyInstance type. This object has a property Location that usually have type LocationPoint. Yu can have the coordinates of the location point it in this way:
((instance as FamilyInstance).Location as LocationPoint).Point
in this way you have an XYZ object that represents the location point of your element (coordinates are always in imperial FT).
To insert a related instance you can simply use the same command giving a location relative to the parent location:
var relatedInstance = document.Create.NewFamilyInstance(new XYZ(parentPoint.X + offset,parentPoint.Y + offset,parentPoint.Z + offset), childFamilySymbol, StructuralType.NonStructural);
Hope this reply to your questions.
Tobia