private AISInteractiveObject UpdateShapeInteractive(Node node, TopoDSShape topoDsShape) { AISInteractiveObject interactiveShape; var haveInteractiveShape = ShapeList.TryGetValue(node.Index, out interactiveShape); if (haveInteractiveShape) { AISShape shape = interactiveShape.Convert <AISShape>(); if (shape != null) { shape.Set(topoDsShape); interactiveShape.Redisplay(false); } } else { interactiveShape = new AISShape(topoDsShape); ShapeList[node.Index] = interactiveShape; if (ShapeUtils.IsPlanarFace(topoDsShape)) { var drawer = interactiveShape.Attributes; var shadingAspect = drawer.ShadingAspect; var shadingAspectAspect = shadingAspect.Aspect; shadingAspectAspect.EdgeColor = (ShapeUtils.GetOccColor(Color.Black)); //shadingAspectAspect.SetEdgeWidth(1); shadingAspectAspect.SetEdgeOn(); } } return(interactiveShape); }
public void Draw() { if (_text != null) { _layer.Color = ShapeUtils.GetOccColor(Color); _layer.SetTextAttributes("Arial", AspectTypeOfDisplayText.Aspect_TODT_NORMAL, ShapeUtils.GetOccColor(Color.Black)); _layer.DrawText(_text, _x, _y, 12.0); } }
private void ApplyColor(NodeBuilder builder, AISInteractiveObject aisShape) { var parent = builder.Node; var col = Color.DarkTurquoise; var colorInterpreter = parent.Get <DrawingAttributesInterpreter>(); if (colorInterpreter.HasColorSet) { col = colorInterpreter.Color; } var color = ShapeUtils.GetOccColor(col); _context.SetColor(aisShape, color, false); }
public static AISInteractiveObject TextureShape(TopoDSShape shape, string texture, Node node) { var texturedShape = new AISTexturedShape(shape); var textNameWrapper = new TCollectionAsciiString(texture); node.Set <ObjectInterpreter>().Data = textNameWrapper; texturedShape.TextureFileName = textNameWrapper; texturedShape.SetTextureMapOn(); texturedShape.SetTextureRepeat(false, 1.0, 1.0); texturedShape.DisplayMode = 3; texturedShape.SetColor(ShapeUtils.GetOccColor(Color.White)); texturedShape.TypeOfPresentation = (PrsMgrTypeOfPresentation3d.PrsMgr_TOP_AllView); return(texturedShape); }
private static void UpdateInteractiveColor(AISInteractiveContext context, Node parent, AISInteractiveObject interactive, bool setWireAspect) { var col = Color.DarkTurquoise; var colorInterpreter = parent.Get <DrawingAttributesInterpreter>(); if (colorInterpreter.HasNoColor) { context.Display(interactive, false); return; } if (colorInterpreter.HasColorSet) { col = colorInterpreter.Color; } var color = ShapeUtils.GetOccColor(col); var layerContainer = parent.Root.Get <LayerContainerInterpreter>(); if (layerContainer.UseLayerColors) { var layerIndex = parent.Get <LayerVisibilityInterpreter>().TagIndex; color = ShapeUtils.GetOccColor(layerContainer.LayerColors[layerIndex]); } context.SetColor(interactive, color, false); var drawer = interactive.Attributes; if (setWireAspect) { var wireAspect = drawer.WireAspect; wireAspect.SetColor(color.Name()); wireAspect.Width = (1.5); drawer.LineAspect = (new Prs3dLineAspect(QuantityNameOfColor.Quantity_NOC_GRAY70, AspectTypeOfLine.Aspect_TOL_DOT, 0.5)); var pointAspect = drawer.PointAspect; pointAspect.SetColor(color.Name()); pointAspect.Scale = (1); context.SetDisplayMode(interactive, (int)colorInterpreter.DisplayMode, false); } if (colorInterpreter.EnableSelection == false) { interactive.UnsetSelectionMode(); interactive.HilightMode = (3); } context.Display(interactive, false); }
public void Draw() { if (_layers.Count == 0) { return; } _layer.Clear(); _layer.Begin(); _layer.SetTextAttributes("Arial", AspectTypeOfDisplayText.Aspect_TODT_NORMAL, ShapeUtils.GetOccColor(Color.Black)); foreach (var layer2D in _layers.Values) { layer2D.Draw(); } _layer.End(); }
public override bool Execute() { Parent.Get <DrawingAttributesInterpreter>().HasNoColor = true; var point3D = Dependency[0].TransformedPoint3D; var scale = Dependency[1].Real; var markerType = (AspectTypeOfMarker)Dependency[2].Integer; var col = Parent.Get <DrawingAttributesInterpreter>().Color; var color = ShapeUtils.GetOccColor(col); var cartesianPoint = new GeomCartesianPoint(point3D.X, point3D.Y, point3D.Z); var marker = new AISPoint(cartesianPoint); var drawer = marker.Attributes; // drawer.PointAspect((new Prs3dPointAspect(markerType, color, scale))); marker.UnsetSelectionMode(); Interactive = marker; return(true); }
private void UpdateOccOptions() { var optionsSetup = _actionGraph[InputNames.OptionsSetupInput].Get <OptionsSetup>(); var occOptions = optionsSetup.UpdateSectionNode(OptionSectionNames.Background); _view.SetBackgroundColor(ShapeUtils.GetOccColor(occOptions.GetColorValue(0))); if (occOptions.GetBoolValue(2)) { _view.SetAntialiasingOn(); } else { _view.SetAntialiasingOff(); } var firstColor = occOptions.GetColorValue(4); var secondColor = occOptions.GetColorValue(5); GeomUtils.MakeGradient("background2.bmp", 32, 128, firstColor, secondColor); //SetNewGradientBackground(); _viewer.Redraw(); }
public void Run(IOccContainerMultiView sceneWorkspace, ActionsGraph actionsGraph, PartModelingView newView, ViewInfo viewInfo) { _attachedView = sceneWorkspace; _actionGraph = actionsGraph; var uiItems = _actionGraph[InputNames.UiElementsItem].GetData(NotificationNames.GetValue).Get <UiElementsItem.Items>(); _treeView = uiItems.TreeView; _wpfPropertyView = (PropertyGridView)uiItems.WpfPropertyView; _wpfLayerView = (LayerView)uiItems.LayerView; _helpView = uiItems.HelpView; _commandLineView = _actionGraph[InputNames.CommandLineView].GetData(NotificationNames.GetValue).Get <CommandLineView>(); _metaModifierContainer = new CommandList(_actionGraph); _actionGraph.OnSwitchAction += UpdateSwitchAction; Application.DoEvents(); _actionGraph.Register(new FunctionFactoryInput()); DefaultFunctions.Setup(_actionGraph); var defaultConstraintFunctions = new DefaultConstraintFunctions(); defaultConstraintFunctions.Setup(_actionGraph); OccInitialize.Setup(ref _device, ref _viewer, ref _context, out _view, _attachedView); InitDocument(); _solver = new Solver(_document); UpdateSolverOptions(); ViewInfoSetup(viewInfo); RegisterModifiers(); InitializeInputs(); DefineShapeConcepts(); SetupChangedShapeEvent(); ViewInfoPostSetup(); UserInterfaceSetup(); SwitchUserAction(ModifierNames.StartUp); var optionsSetup = actionsGraph[InputNames.OptionsSetupInput].Get <OptionsSetup>(); optionsSetup.Register(new AutoSaveOptionsItem()); var occSection = optionsSetup.UpdateSectionNode(OptionSectionNames.Background); var color = occSection.GetColorValue(0); _viewer.SetDefaultBackgroundColor((ShapeUtils.GetOccColor(color))); //SetGradientBackground(); ForceStartupViewUpdate(); OptionsEventMapping(optionsSetup); var presenter = newView.GetPresenter(); presenter.OnMouseMoveHandler += MouseMoveHandler; presenter.OnMouseDownHandler += MouseDownHandler; presenter.OnMouseUpHandler += MouseUpHandler; presenter.OnMouseWheelHandler += MouseWheelHandler; presenter.OnResizeEvent += ResizeView; ApplicationNotificationUtils.Instance.ExitingApplication += () => SwitchUserAction(ModifierNames.NaroExit); _view.SurfaceDetail = V3dTypeOfSurfaceDetail.V3d_TEX_ALL; new SketchSolveUpdater(_document); SetOriginalGradientBackground(); ResumeRunning(); }