Hi all,
I am attempting to place a Line-Based family hosted to a Level/Reference Plane using the API within a Family Document but despite my best efforts I have been unsuccessful. I know it’s possible to place a Line-Based family in a Project document but the method within a Family Document eludes me.
I am attempting to use the NewFamilyInstance method of the ItemFacotryBase, specifically NewFamilyInstance Method (Reference, Line, FamilySymbol), which I think is the correct method, but no matter what I attempt to use as the Reference I get an error of ‘Family cannot be placed on this line as it does not coincide with the input face’. I am assuming that this is either due to how I am generating/accessing the Reference or how I am generating the Line/Curve - but I am unsure what specifically. I did stumble into an old post on the BuildingCoder regarding this error and placing on Geometry but it has.
Has anyone had success placing a Line-Based family inside a Family Document that can point me in the right direction? Or tell me it is not supported if I have completely misinterpreted the API docs.
#ORIGINAL LOCATION IN PROJECT
pointStartOriginal=line.GetEndPoint(0)
pointEndOriginal=line.GetEndPoint(1)
#TRANSLATION FROM PROJECT POSITION TO FAMILY POSITION
translationVector=DB.XYZ(0,0,0)-adjusted_midpoint
translation_transform = DB.Transform.CreateTranslation(translationVector)
pointStartTranlsated = translation_transform.OfPoint(pointStartOriginal)
pointEndTranlsated = translation_transform.OfPoint(pointEndOriginal)
#ENSURE START AND END POINT AT Z=0
pointStart=DB.XYZ(pointStartTranlsated.X,pointStartTranlsated.Y,0)
pointEnd=DB.XYZ(pointEndTranlsated.X,pointEndTranlsated.Y,0)
#CREATE PLANE / SKETCH PLANE / REFERENCE
linePlane =DB.Plane.CreateByThreePoints(pointStart,pointEnd,DB.XYZ(0,0,0))
lineSketch=DB.SketchPlane.Create(family_document, linePlane)
lineRef=lineSketch.GetPlaneReference()
#CREATE FINAL LINE + MODEL CURVE
lineTranslated = line.CreateBound(pointStart, pointEnd)
newLine=family_document.FamilyCreate.NewModelCurve(lineTranslated,lineSketch)
#PLACE FAMILY
family_instance = family_document.FamilyCreate.NewFamilyInstance(lineRef,lineTranslated,element).