/// <summary>
/// 创建球体
/// </summary>
/// <param name="doc"></param>
public static void CreateSpereModel(BPDocument doc)
{
BPViewport view = doc.viewManager.getActivedViewport();
BPModel model = doc.modelManager.activeModel;
//BPGraphicUtil.deleteGraphicsOfModel(doc, model); //清空模型空间的模型
BPGraphics g = new BPGraphics();
//坐标(0,0,0),半径为10的球
GeSphereInfo info = new GeSphereInfo(new GePoint3d(0, 0, 0), 10);
IGeSolidBase geSolid = IGeSolidBase.createSphere(info);
//颜色,红色,透明度50%
BPGeSymbology bPGe = new BPGeSymbology();
bPGe.color = Color.Red;
bPGe.style = 0;//线型为实线
bPGe.weight = 1;
g.addSolid(geSolid,bPGe,0.5); //0.5指透明度50%
g.save();
view.zoomToEntity(BPGraphicUtil.getGraphicsOfModel(doc, model));
}
/// <summary>
/// 创建锥体
/// </summary>
/// <param name="doc"></param>
public static void CreateConeModel(BPDocument doc)
{
BPViewport view = doc.viewManager.getActivedViewport();
BPModel model = doc.modelManager.activeModel;
//BPGraphicUtil.deleteGraphicsOfModel(doc, model); //清空模型空间的模型
BPGraphics g = new BPGraphics();
GePoint3d center1 = new GePoint3d(-25, 0, -10);
GePoint3d center2 = new GePoint3d(-25, 0, 10);
GeConeInfo geCone = new GeConeInfo(center1, center2, 10, 2, true);
IGeSolidBase geSolid = IGeSolidBase.createCone(geCone);
//颜色,橘色,不透明度
BPGeSymbology bPGe = new BPGeSymbology();
bPGe.color = Color.Orange;
bPGe.style = 0;//线型为实线
bPGe.weight = 1;
g.addSolid(geSolid,bPGe,0); //0指不透明度
g.save();
view.zoomToEntity(BPGraphicUtil.getGraphicsOfModel(doc, model));
}
【BIMBase】创建球体和锥体,并设置颜色
于 2024-08-05 20:35:55 首次发布