Example #1
0
	def display(self, objects=None):
		"""Create objects in viewport to display information about this Joint
		
		Creates:    postLabel   id of other post
					jointLabel  id of joint
					orientation orientation plane
					bounds      bounding box of post's end face
					center      "center" of pocket face
					face        millable pocket face
					farthest    plane on post's farthest edge into joint
					holes       center lines for drill holes
					toolpath    milling path for pocket
					axis        normal of pocket face, at center
					
		Returns:    list of guids of added objects
		"""
		
		guids = []
		
		if objects == None:
			objects = ['holes', 'toolpath']
		
		
		if 'postLabel' in objects:
			guids.append(rs.AddTextDot(self.joint.posts[not self.index].printId(), self.origin))
		if 'jointLabel' in objects:
			guids.append(rs.AddTextDot(self.joint.printId(), self.origin))
		if 'orientation' in objects:
			#display orientation plane
			guids.append(common.displayPlane(self.orientation))
		if 'bounds' in objects:
			#display post profile bounding box
			guids.append(common.displayBoundingBox(self.profileBounds, self.orientation, self.profilePlane))
		if 'center' in objects:
			guids.append(sc.doc.Objects.AddPoint(self.orientation.Origin))
		if 'face' in objects:
			#display pocket face
			guids.append(sc.doc.Objects.AddSurface(self.face))
		if 'holes' in objects:
			#display any drill holes
			for h in self.holes:
				guids.append(sc.doc.Objects.AddLine(h))
		if 'toolpath' in objects:
			#display milling paths
			newguids = self.toolpath.display(transform=self.post.selfToGlobal)
			#print newguids
			guids.extend(newguids)
		if 'axis' in objects:
			#display pocket face normal
			g = sc.doc.Objects.AddLine(self.origin, self.origin + self.normal)
			guids.append(g)
		
		return guids
Example #2
0
	def display(self, objects=None):
		"""Create objects in viewport to display information about this post. 
			'objects' determines which objects to display
		
		Creates:
			label       text dot with post id
			orientation aligned plane with corner on post origin
			profile     profile curve
			object      post object, if not using obrefs
			axis        axis Line
			
		Returns:    list of guids of added objects
		"""
		
		guids = []
		
		if objects == None:
			objects = ['label', 'orientation']
		
		if 'label' in objects:
			guids.append(rs.AddTextDot(self.printId(), self.origin))
		if 'orientation' in objects:
			guids.append(common.displayPlane(self.orientation))
		if 'profile' in objects:
			guids.append(sc.doc.Objects.AddCurve(self.profile))
		if 'object' in objects:
			if not self.brep:
				vector = Rhino.Geometry.Vector3d(self.axis.To - self.axis.From)
				guids.append(sc.doc.Objects.AddBrep(
					Rhino.Geometry.Surface.CreateExtrusion(self.profile, vector).ToBrep()))
				rs.CapPlanarHoles(guids[-1])
		if 'axis' in objects:
			guids.append(sc.doc.Objects.AddLine(self.axis))
		if 'xAxis' in objects:
			guids.append(sc.doc.Objects.AddLine(self.origin, self.origin + self.orientation.XAxis))
		
		return guids