目前支持的倒角类型为,
下面的例子创建了一个圆角半径为 0.2 的矩形,
1. auto uor = ISessionMgr::GetActiveDgnModelP()->GetModelInfo().GetUorPerMeter(); 2. 3. auto library = CIM::CIMTemplate::ITemplateLibrary::Create(); 4. auto category = library->AddCategory(L"UseCase"); 5. auto t = category->AddTemplate(L"Fillet"); 6. 7. auto P0 = t->AddPoint(0, 0); 8. auto P1 = t->AddPoint(1, 0); 9. auto P2 = t->AddPoint(1, -1); 10. auto P3 = t->AddPoint(0, -1); 11. 12. P1->SetCornerType(CIM::CIMTemplate::IPoint::CornerType::Fillet); 13. P1->SetFillet(0.2); 14. 15. auto shape = t->AddComponent(); 16. shape->AddLine(P0->GetName().GetWCharCP(), P1->GetName().GetWCharCP()); 17. shape->AddLine(P1->GetName().GetWCharCP(), P2->GetName().GetWCharCP()); 18. shape->AddLine(P2->GetName().GetWCharCP(), P3->GetName().GetWCharCP()); 19. shape->AddLine(P3->GetName().GetWCharCP(), P0->GetName().GetWCharCP()); 20. 21. auto curve = t->ToCurveVector();
你需要设置倒角类型并且设定合适的倒角半径,生成的图形如下
这是一个创建直倒角的例子,
1. auto uor = ISessionMgr::GetActiveDgnModelP()->GetModelInfo().GetUorPerMeter(); 2. 3. auto library = CIM::CIMTemplate::ITemplateLibrary::Create(); 4. auto category = library->AddCategory(L"UseCase"); 5. auto t = category->AddTemplate(L"Chamfer"); 6. 7. auto P0 = t->AddPoint(0, 0); 8. auto P1 = t->AddPoint(1, 0); 9. auto P2 = t->AddPoint(1, -1); 10. auto P3 = t->AddPoint(0, -1); 11. 12. P1->SetCornerType(CIM::CIMTemplate::IPoint::CornerType::Chamfer); 13. P1->SetChamfer(0.1, 0.2, P0->GetName().GetWCharCP(), P2->GetName().GetWCharCP()); 14. 15. auto shape = t->AddComponent(); 16. shape->AddLine(P0->GetName().GetWCharCP(), P1->GetName().GetWCharCP()); 17. shape->AddLine(P1->GetName().GetWCharCP(), P2->GetName().GetWCharCP()); 18. shape->AddLine(P2->GetName().GetWCharCP(), P3->GetName().GetWCharCP()); 19. shape->AddLine(P3->GetName().GetWCharCP(), P0->GetName().GetWCharCP()); 20. 21. auto curve = t->ToCurveVector();
你需要设置倒角类型和合适的数值,生成图形如下,