def __init__(self, name="GridView"): super(gridView, self).__init__() self.setName(name) self._number_of_points = 50 self._center = (0, 0) self._scale = 1.0 self._axis = 0 # 1=X 2=Y 3=Z self.transform = coin.SoTransform() self.coord = coin.SoCoordinate3() self.sep1 = coin.SoSeparator() self.sep1.setName("Snap_Points") self.sep2 = coin.SoSeparator() self.sep2.setName("Grid") self.sep3 = coin.SoSeparator() self.sep3.setName("Axis") self.addChild(self.transform) self.addChild(self.coord) self.addChild(self.sep1) self.addChild(self.sep2) self.addChild(self.sep3) ps = coin.SoPointSet() ds = coin.SoDrawStyle() ds.pointSize = 1 self.sep1.addChild(ds) self.sep1.addChild(ps) self.color1 = (0.82, 0.15, 0.15) # red (X) self.color2 = (0.40, 0.59, 0.20) # green (Y) self.color3 = (0.13, 0.49, 0.88) # blue (Z)
def attach(self, vobj): # self.ViewObject = vobj self.Object = vobj.Object self.gridDM = coin.SoGroup() self.pointsDM = coin.SoGroup() self.ProfDM = coin.SoGroup() self.railDM = coin.SoGroup() self.coord = CoinNodes.coordinate3Node(self.Object.Points) self.row = CoinNodes.rowNode((0.8, 0.4, 0.4), 1.0) self.col = CoinNodes.colNode((0.4, 0.4, 0.8), 1.0) self.pointSet = coin.SoPointSet() self.style = CoinNodes.styleNode((0, 0, 0), 1.0, 2.0) self.style.addChild(self.pointSet) # vobj.addChild(self.coord) self.ProfDM.addChild(self.coord) self.ProfDM.addChild(self.row) self.railDM.addChild(self.coord) self.railDM.addChild(self.col) self.gridDM.addChild(self.coord) self.gridDM.addChild(self.row) self.gridDM.addChild(self.col) self.pointsDM.addChild(self.coord) self.pointsDM.addChild(self.style) # self.points.addChild(self.pointSet) vobj.addDisplayMode(self.gridDM, "Wireframe") vobj.addDisplayMode(self.pointsDM, "Points") vobj.addDisplayMode(self.ProfDM, "Profiles") vobj.addDisplayMode(self.railDM, "Rails")
def attach(self, vobj): self.out = coin.SoSeparator() self.point = coin.SoPointSet() self.data = coin.SoCoordinate3() self.drawstyle = coin.SoDrawStyle() self.color = coin.SoMaterial() self.color.diffuseColor.setValue(0, 0, 0) self.drawstyle.style = coin.SoDrawStyle.POINTS self.drawstyle.pointSize = 5. self.out.addChild(self.color) self.out.addChild(self.drawstyle) self.out.addChild(self.data) self.out.addChild(self.point) vobj.addDisplayMode(self.out, 'out')
def attach(self, vobj): ''' Create Object visuals in 3D view. ''' # GeoCoord Node. self.geo_coords = coin.SoGeoCoordinate() # Point group features. points = coin.SoPointSet() self.markers = coin.SoMarkerSet() self.color_mat = coin.SoMaterial() self.point_normal = coin.SoNormal() self.point_style = coin.SoDrawStyle() self.point_style.style = coin.SoDrawStyle.POINTS # Highlight for selection. highlight = coin.SoType.fromName('SoFCSelection').createInstance() #highlight.documentName.setValue(FreeCAD.ActiveDocument.Name) #highlight.objectName.setValue(vobj.Object.Name) #highlight.subElementName.setValue("Main") highlight.addChild(self.geo_coords) highlight.addChild(points) highlight.addChild(self.markers) # Point labels features. color =coin.SoBaseColor() self.point_labels = coin.SoSeparator() self.point_labels.addChild(color) # Point group root. point_root = coin.SoSeparator() point_root.addChild(self.point_labels) point_root.addChild(self.point_style) point_root.addChild(self.point_normal) point_root.addChild(self.color_mat) point_root.addChild(highlight) vobj.addDisplayMode(point_root,"Point") # Take features from properties. if vobj.Object.Points: self.onChanged(vobj,"Elevation") self.onChanged(vobj,"PointSize") self.onChanged(vobj,"PointColor")
def __init__(self, points, dynamic=False): super(Point, self).__init__(points, dynamic) self.drawstyle = coin.SoDrawStyle() self.point = coin.SoPointSet() self.addChild(self.drawstyle) self.addChild(self.point)