//-------------------------------------------------------------------------------------------------- void _UpdatePresentationForGhost() { _AisShape.SetDisplayMode((int)AIS_DisplayMode.AIS_Shaded); var ghostDrawer = new Prs3d_Drawer(); ghostDrawer.Link(_AisShape.Attributes()); var shadingAspect = new Prs3d_ShadingAspect(); shadingAspect.SetColor(Colors.Ghost); shadingAspect.SetTransparency(0.5); ghostDrawer.SetShadingAspect(shadingAspect); var lineAspect = new Prs3d_LineAspect(Colors.Ghost, Aspect_TypeOfLine.Aspect_TOL_SOLID, 2.0); ghostDrawer.SetLineAspect(lineAspect); ghostDrawer.SetSeenLineAspect(lineAspect); ghostDrawer.SetWireAspect(lineAspect); ghostDrawer.SetFaceBoundaryAspect(lineAspect); ghostDrawer.SetFreeBoundaryAspect(lineAspect); ghostDrawer.SetUnFreeBoundaryAspect(lineAspect); ghostDrawer.SetPointAspect(new Prs3d_PointAspect(Aspect_TypeOfMarker.Aspect_TOM_O_POINT, Colors.Ghost, 2.0)); ghostDrawer.SetFaceBoundaryDraw(true); _AisShape.SetAttributes(ghostDrawer); }
//-------------------------------------------------------------------------------------------------- static void _UpdateAttributesForLayer(Layer layer, ref AttributeSet attributeSet) { // Normal mode Drawer var shadingAspect = new Prs3d_ShadingAspect(); shadingAspect.SetColor(layer.Color.ToQuantityColor()); shadingAspect.SetMaterial(Graphic3d_NameOfMaterial.Graphic3d_NOM_PLASTIC.ToAspect()); shadingAspect.SetTransparency(layer.Transparency); attributeSet.Drawer.SetShadingAspect(shadingAspect); var lineAspect = new Prs3d_LineAspect(layer.Color.ToQuantityColor(), layer.LineStyle.TypeOfLine(), layer.LineThickness.LineWidth()); attributeSet.Drawer.SetLineAspect(lineAspect); attributeSet.Drawer.SetSeenLineAspect(lineAspect); attributeSet.Drawer.SetWireAspect(lineAspect); attributeSet.Drawer.SetFaceBoundaryAspect(lineAspect); attributeSet.Drawer.SetFreeBoundaryAspect(lineAspect); attributeSet.Drawer.SetUnFreeBoundaryAspect(lineAspect); attributeSet.Drawer.SetPointAspect(new Prs3d_PointAspect(Aspect_TypeOfMarker.Aspect_TOM_O_POINT, layer.Color.ToQuantityColor(), 2.0)); attributeSet.Drawer.SetFaceBoundaryDraw(layer.PresentationMode == PresentationMode.SolidWithBoundary); attributeSet.Drawer.SetDisplayMode((int)(layer.PresentationMode == PresentationMode.Wireframe ? AIS_DisplayMode.AIS_WireFrame : AIS_DisplayMode.AIS_Shaded)); attributeSet.Drawer.SetTypeOfDeflection(Aspect_TypeOfDeflection.Aspect_TOD_RELATIVE); // Hilight Drawer shadingAspect = new Prs3d_ShadingAspect(); shadingAspect.SetColor(layer.Color.ToQuantityColor()); shadingAspect.SetMaterial(Graphic3d_NameOfMaterial.Graphic3d_NOM_PLASTIC.ToAspect()); shadingAspect.SetTransparency(0); attributeSet.HilightDrawer.SetShadingAspect(shadingAspect); lineAspect = new Prs3d_LineAspect(Colors.Selection, Aspect_TypeOfLine.Aspect_TOL_SOLID, 3.0); attributeSet.HilightDrawer.SetLineAspect(lineAspect); attributeSet.HilightDrawer.SetSeenLineAspect(lineAspect); attributeSet.HilightDrawer.SetWireAspect(lineAspect); attributeSet.HilightDrawer.SetFaceBoundaryAspect(lineAspect); attributeSet.HilightDrawer.SetFreeBoundaryAspect(lineAspect); attributeSet.HilightDrawer.SetUnFreeBoundaryAspect(lineAspect); attributeSet.HilightDrawer.SetPointAspect(Marker.CreateBitmapPointAspect(Marker.BallImage, Colors.Selection)); //TODO attributeSet.HilightDrawer.SetHighlightStyle(new Graphic3d_HighlightStyle(Aspect_TypeOfHighlightMethod.Aspect_TOHM_COLOR, new Quantity_Color(Quantity_NameOfColor.Quantity_NOC_ALICEBLUE))); attributeSet.HilightDrawer.SetTypeOfDeflection(Aspect_TypeOfDeflection.Aspect_TOD_RELATIVE); attributeSet.HilightDrawer.SetFaceBoundaryDraw(layer.PresentationMode == PresentationMode.SolidWithBoundary); attributeSet.HilightDrawer.SetDisplayMode(0); }
//-------------------------------------------------------------------------------------------------- void _InitVisualSettings() { var aisContext = Workspace.AisContext; _UpdateParameter(); // Higlight Selected var selectionDrawer = new Prs3d_Drawer(); selectionDrawer.SetColor(Colors.Selection); selectionDrawer.SetDisplayMode(0); selectionDrawer.SetZLayer(0); // Graphic3d_ZLayerId_Default selectionDrawer.SetTypeOfDeflection(Aspect_TypeOfDeflection.Aspect_TOD_RELATIVE); selectionDrawer.SetDeviationAngle(aisContext.DeviationAngle()); selectionDrawer.SetDeviationCoefficient(aisContext.DeviationCoefficient()); aisContext.SetSelectionStyle(selectionDrawer); aisContext.SetHighlightStyle(Prs3d_TypeOfHighlight.Prs3d_TypeOfHighlight_Selected, selectionDrawer); aisContext.SetHighlightStyle(Prs3d_TypeOfHighlight.Prs3d_TypeOfHighlight_LocalSelected, selectionDrawer); aisContext.SetHighlightStyle(Prs3d_TypeOfHighlight.Prs3d_TypeOfHighlight_SubIntensity, selectionDrawer); // Higlight Dynamic var hilightDrawer = new Prs3d_Drawer(); hilightDrawer.SetColor(Colors.Highlight); hilightDrawer.SetDisplayMode(0); hilightDrawer.SetZLayer(-2); // Graphic3d_ZLayerId_Top hilightDrawer.SetTypeOfDeflection(Aspect_TypeOfDeflection.Aspect_TOD_RELATIVE); hilightDrawer.SetDeviationAngle(aisContext.DeviationAngle()); hilightDrawer.SetDeviationCoefficient(aisContext.DeviationCoefficient()); aisContext.SetHighlightStyle(Prs3d_TypeOfHighlight.Prs3d_TypeOfHighlight_Dynamic, hilightDrawer); // Higlight Local var hilightLocalDrawer = new Prs3d_Drawer(); hilightLocalDrawer.SetColor(Colors.Highlight); hilightLocalDrawer.SetDisplayMode(1); hilightLocalDrawer.SetZLayer(-2); // Graphic3d_ZLayerId_Top hilightLocalDrawer.SetTypeOfDeflection(Aspect_TypeOfDeflection.Aspect_TOD_RELATIVE); hilightLocalDrawer.SetDeviationAngle(aisContext.DeviationAngle()); hilightLocalDrawer.SetDeviationCoefficient(aisContext.DeviationCoefficient()); var shadingAspect = new Prs3d_ShadingAspect(); shadingAspect.SetColor(Colors.Highlight); shadingAspect.SetTransparency(0); var aspectFill = new Graphic3d_AspectFillArea3d(shadingAspect.Aspect()); aspectFill.SetPolygonOffsets((int)Aspect_PolygonOffsetMode.Aspect_POM_Fill, 0.99f, 0.0f); shadingAspect.SetAspect(aspectFill); hilightLocalDrawer.SetShadingAspect(shadingAspect); var lineAspect = new Prs3d_LineAspect(Colors.Highlight, Aspect_TypeOfLine.Aspect_TOL_SOLID, 3.0); hilightLocalDrawer.SetLineAspect(lineAspect); hilightLocalDrawer.SetSeenLineAspect(lineAspect); hilightLocalDrawer.SetWireAspect(lineAspect); hilightLocalDrawer.SetFaceBoundaryAspect(lineAspect); hilightLocalDrawer.SetFreeBoundaryAspect(lineAspect); hilightLocalDrawer.SetUnFreeBoundaryAspect(lineAspect); hilightLocalDrawer.SetPointAspect(Marker.CreateBitmapPointAspect(Marker.BallImage, Colors.Highlight)); aisContext.SetHighlightStyle(Prs3d_TypeOfHighlight.Prs3d_TypeOfHighlight_LocalDynamic, hilightLocalDrawer); }