下载app免费领取会员
问题:咋直接根据CAD图纸进行异形柱翻模?
解决难点1:获取CAD异形柱信息,创建异形柱族。
解决难点2:异形柱族加载进项目时的位置点是(0,0,0)及坐标转换。
根据CAD图纸进行柱子翻模,其中异形柱翻模最为关键,而异形柱根据轴网放置往往不能满足要求,我的解决办法是根据其重心作为它的LocationPoint,然后对柱子形状进行判断,最后放置即可。
这里只阐述异形柱翻模最核心的部分,就是根据CAD图纸创建的族的重心移动到(0,0,0)位置,效果如下:
其轮廓坐标点:(10/304.8,0,0),(10/304.8,20/304.8,0),(20/304.8,20/304.8,0),(30/304.8,10/304.8,0),(30/304.8,0,0)

Autodesk.Revit.ApplicationServices.Applicationapp=commandData.Application.Application;
stringrftpath=@"C:\ProgramData\Autodesk\RVT2019\FamilyTemplates\Chinese\公制结构柱.rft";
DocumentfaDoc=app.NewFamilyDocument(rftpath);
using(Transactionts=newTransaction(faDoc,"创建族"))
{
ts.Start();
List<XYZ>pointList=newList<XYZ>();
pointList.Add(newXYZ(10/304.8,0,0));
pointList.Add(newXYZ(10/304.8,20/304.8,0));
pointList.Add(newXYZ(20/304.8,20/304.8,0));
pointList.Add(newXYZ(30/304.8,10/304.8,0));
pointList.Add(newXYZ(30/304.8,0,0));
//创建工作平面
Planeplane=Plane.CreateByNormalAndOrigin(XYZ.BasisZ,XYZ.Zero);
SketchPlanesketchPlane=SketchPlane.Create(faDoc,plane);
CurveArrArraycurveArrArray=newCurveArrArray();
CurveArraycurveArray=newCurveArray();
curveArray.Append(Line.CreateBound(pointList[0],pointList[1]));
curveArray.Append(Line.CreateBound(pointList[1],pointList[2]));
curveArray.Append(Line.CreateBound(pointList[2],pointList[3]));
curveArray.Append(Line.CreateBound(pointList[3],pointList[4]));
curveArray.Append(Line.CreateBound(pointList[4],pointList[0]));
curveArrArray.Append(curveArray);
Extrusionextrusion=faDoc.FamilyCreate.NewExtrusion(true,curveArrArray,sketchPlane,1000);
faDoc.FamilyManager.NewType("异形柱");
Elementele=extrusionasElement;
ColumnLocationPointlocationPoint=newColumnLocationPoint();
XYZcenterpoint=null;
locationPoint.GravityCenter(pointList,outcenterpoint);
TaskDialog.Show("输出位置坐标",(centerpoint.X*304.8).ToString()+"\n"+(centerpoint.Y*304.8).ToString()
+"\n"+(centerpoint.Z*304.8).ToString());
XYZpointmove=newXYZ(-centerpoint.X,-centerpoint.Y,-centerpoint.Z);
ElementTransformUtils.MoveElement(faDoc,ele.Id,pointmove);
ts.Commit();
faDoc.SaveAs(@"G:\SpecialShapedColumn\mam63.rfa");
faDoc.Close();
}
文章来源:BIM探知先生
仅作分享交流,文章著作权归原作者所有。
转载请注明来源本文地址:https://www.tuituisoft/bim/14944.html
上一篇:没有了
下一篇:没有了