Python Part.show() Examples
The following are 30
code examples of Part.show().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
Part
, or try the search function
.
Example #1
Source File: FSNuts.py From FreeCAD_FastenersWB with GNU General Public License v2.0 | 6 votes |
def makeSquareTool(s, m): # makes a cylinder with an inner square hole, used as cutting tool # create square face msq = Base.Matrix() msq.rotateZ(math.radians(90.0)) polygon = [] vsq = Base.Vector(s / 2.0, s / 2.0, -m * 0.1) for i in range(4): polygon.append(vsq) vsq = msq.multiply(vsq) polygon.append(vsq) square = Part.makePolygon(polygon) square = Part.Face(square) # create circle face circ = Part.makeCircle(s * 3.0, Base.Vector(0.0, 0.0, -m * 0.1)) circ = Part.Face(Part.Wire(circ)) # Create the face with the circle as outline and the square as hole face=circ.cut(square) # Extrude in z to create the final cutting tool exSquare = face.extrude(Base.Vector(0.0, 0.0, m * 1.2)) # Part.show(exHex) return exSquare
Example #2
Source File: Animation.py From Animation with GNU General Public License v2.0 | 6 votes |
def showimage(fn): mpl=MatplotlibWidget() mpl.resize(100,100) mpl.show() plt=mpl.figure plt.clf() img2=mpimg.imread(fn) plt.figimage(img2) l,b,c=img2.shape mpl.draw() mpl.resize(b,l) return mpl #fn='/home/thomas/Bilder/bp_111.png' #rc=showimage(fn)
Example #3
Source File: Animation.py From Animation with GNU General Public License v2.0 | 6 votes |
def doubleClicked(self,vobj): FreeCAD.tt=self #say(self) #panel = AddMyTask(runManager,stopManager,unlockManager) panel = AddMyTask(self,runManager,stopManager,loopManager,unloopManager) # panel.form.volvalue.setText("VOL-VALUE") # panel.form.vollabel.setText("VOL-LABELLO") panel.form.pushButton.setText("Run ") panel.form.pushButton2.setText("Stop") panel.form.pushButton4.setText("Loop") panel.form.pushButton5.setText("Unloop") panel.form.pushButton6.setText("Refresh") # FreeCADGui.Control.showDialog(panel) self.dialog=panel.form self.dialog.show() #---------------------------------------------------------------
Example #4
Source File: SheetMetalUnfolder.py From FreeCAD_SheetMetal with GNU General Public License v3.0 | 6 votes |
def sew_Shape(): """checking Shape""" doc=FreeCAD.ActiveDocument docG = FreeCADGui.ActiveDocument sel=FreeCADGui.Selection.getSelection() if len (sel) == 1: o = sel[0] if hasattr(o,'Shape'): sh = o.Shape.copy() sh.sewShape() sl = Part.Solid(sh) docG.getObject(o.Name).Visibility = False Part.show(sl) ao = FreeCAD.ActiveDocument.ActiveObject ao.Label = 'Solid' docG.ActiveObject.ShapeColor=docG.getObject(o.Name).ShapeColor docG.ActiveObject.LineColor=docG.getObject(o.Name).LineColor docG.ActiveObject.PointColor=docG.getObject(o.Name).PointColor docG.ActiveObject.DiffuseColor=docG.getObject(o.Name).DiffuseColor docG.ActiveObject.Transparency=docG.getObject(o.Name).Transparency else: FreeCAD.Console.PrintError('select only one object')
Example #5
Source File: dev.py From NodeEditor with MIT License | 6 votes |
def cylindricprojection(self,*args, **kwargs): s=App.activeDocument().ReflectLines001.Shape eds=[] for e in s.Edges: pts2=[] pts=e.discretize(100) for p in pts: h=p.y arc=np.arctan2(p.x,p.z) r=FreeCAD.Vector(p.x,p.z).Length R=150 p2=FreeCAD.Vector(np.sin(arc)*R,h,np.cos(arc)*R) pts2 += [p2] Part.show(Part.makePolygon(pts2)) #--------------------------
Example #6
Source File: Trackreader.py From Animation with GNU General Public License v2.0 | 5 votes |
def edit(self): self.dialog=EditWidget(self,self.emenu) self.dialog.show()
Example #7
Source File: SheetMetalUnfolder.py From FreeCAD_SheetMetal with GNU General Public License v3.0 | 5 votes |
def radial_vector(point, axis_pnt, axis): chord = axis_pnt.sub(point) norm = axis.cross(chord) perp = axis.cross(norm) # FreeCAD.Console.PrintLog( str(chord) + ' ' + str(norm) + ' ' + str(perp)+'\n') dist_rv = DraftVecUtils.project(chord,perp) #test_line = Part.makeLine(axis_pnt.add(dist_rv),axis_pnt) # test_line = Part.makeLine(axis_pnt.add(perp),axis_pnt) # test_line = Part.makeLine(point, axis_pnt) # Part.show(test_line) return perp.normalize()
Example #8
Source File: crosspart.py From LCInterlocking with GNU Lesser General Public License v2.1 | 5 votes |
def is_inside(face, shape_to_test): normal = face.normalAt(0, 0) point = face.CenterOfMass + normal.normalize() * 0.1 sphere = Part.makeSphere(0.04, point) #Part.show(sphere) return sphere.common(shape_to_test).Volume > 0.00001
Example #9
Source File: SheetMetalUnfolder.py From FreeCAD_SheetMetal with GNU General Public License v3.0 | 5 votes |
def generateBendShell2(self, bend_node): ''' This function takes a cylindrical bend part of sheet metal and returns a flat version of that bend part. ''' theCenter = bend_node.bendCenter # theCyl.Surface.Center theAxis = bend_node.axis # theCyl.Surface.Axis # theRadius = theCyl.Surface.Radius # need to include the k-Factor zeroVert = bend_node.p_edge.Vertexes[0] nullVec = radial_vector(zeroVert.Point, theCenter, theAxis) #nullVec_line = Part.makeLine(theCenter, theCenter + nullVec*bend_node.innerRadius) #Part.show(nullVec_line, 'nullVec_line'+ str(bend_node.idx+1)+'_') #tanVec_line = Part.makeLine(zeroVert.Point, zeroVert.Point + bend_node.tan_vec*bend_node.innerRadius) #Part.show(tanVec_line, 'tanVec_line'+ str(bend_node.idx+1)+'_') # calculate the unbend points in the bend_ node.vertexDict self.unbendVertDict(bend_node, theCenter, theAxis, nullVec) bendFaceList = bend_node.nfIndexes[:] bendFaceList.remove(bend_node.idx) bendFaceList.remove(bend_node.c_face_idx) flat_shell = [] flat_shell.append(self.unbendFace(bend_node.idx, bend_node, nullVec, 'top')) flat_shell.append(self.unbendFace(bend_node.c_face_idx, bend_node, nullVec, 'counter')) for i in bendFaceList: bFace = self.unbendFace(i, bend_node, nullVec) flat_shell.append(bFace) #Part.show(bFace, 'bFace'+str(i +1)) #for v in bFace.Vertexes: # print 'Face'+str(i+1) + ' ' + str(v.X) + ' ' + str(v.Y) + ' ' + str(v.Z) foldwires = self.makeFoldLines(bend_node, nullVec) #print 'face idx: ', bend_node.idx +1, ' folds: ', foldwires return flat_shell, foldwires
Example #10
Source File: SheetMetalUnfolder.py From FreeCAD_SheetMetal with GNU General Public License v3.0 | 5 votes |
def showFaces(self): for i in self.index_list: Part.show(self.f_list[i])
Example #11
Source File: Tracker.py From Animation with GNU General Public License v2.0 | 5 votes |
def edit(self): self.dialog=EditNoDialWidget(self,self.emenu) self.dialog.show()
Example #12
Source File: SheetMetalJunction.py From FreeCAD_SheetMetal with GNU General Public License v3.0 | 5 votes |
def smJunction(gap = 2.0, selEdgeNames = '', MainObject = None): import BOPTools.SplitFeatures, BOPTools.JoinFeatures resultSolid = MainObject for selEdgeName in selEdgeNames: edge = MainObject.getElement(selEdgeName) facelist = MainObject.ancestorsOfType(edge, Part.Face) #for face in facelist : # Part.show(face,'face') joinface = facelist[0].fuse(facelist[1]) #Part.show(joinface,'joinface') filletedface = joinface.makeFillet(gap, joinface.Edges) #Part.show(filletedface,'filletedface') cutface1= facelist[0].cut(filletedface) #Part.show(cutface1,'cutface1') offsetsolid1 = cutface1.makeOffsetShape(-gap, 0.0, fill = True) #Part.show(offsetsolid1,'offsetsolid1') cutface2 = facelist[1].cut(filletedface) #Part.show(cutface2,'cutface2') offsetsolid2 = cutface2.makeOffsetShape(-gap, 0.0, fill = True) #Part.show(offsetsolid2,'offsetsolid2') cutsolid = offsetsolid1.fuse(offsetsolid2) #Part.show(cutsolid,'cutsolid') resultSolid = resultSolid.cut(cutsolid) #Part.show(resultsolid,'resultsolid') return resultSolid
Example #13
Source File: Animation.py From Animation with GNU General Public License v2.0 | 5 votes |
def edit(self): anims=self.anims() print(anims) self.dialog=EditWidget(self,self.emenu + anims,False) self.dialog.show()
Example #14
Source File: Animation.py From Animation with GNU General Public License v2.0 | 5 votes |
def step(self,now): App=FreeCAD say("step " +str(now)) s=self.obj2.ext.Spine ss=s[0] kk=s[1] if now==self.obj2.start: kk=[] steps=20 steps=self.obj2.duration l=ss.Shape.copy().discretize(steps) f=Part.makePolygon(l) f1=Part.show(f) ss=FreeCAD.ActiveDocument.Objects[-1] kk.append("Edge"+str(now+1-self.obj2.start)) if now<self.obj2.start: kk=["Edge1"] self.obj2.ext.ViewObject.Visibility=False else: self.obj2.ext.ViewObject.Visibility=True self.obj2.ext.Spine=(ss,kk) FreeCAD.ActiveDocument.recompute() FreeCADGui.updateGui() #---------------------------------------------------------------------------------------------------------- # Movie Screen #----------------------------------------------------------------------------------------------------------
Example #15
Source File: VertexTracker.py From Animation with GNU General Public License v2.0 | 5 votes |
def show(self): for f in self.threads: print(f) for p in self.threads[f]: print(" ",p)
Example #16
Source File: VertexTracker.py From Animation with GNU General Public License v2.0 | 5 votes |
def edit(self): self.dialog=EditNoDialWidget(self,self.emenu) self.dialog.show()
Example #17
Source File: VertexTracker.py From Animation with GNU General Public License v2.0 | 5 votes |
def showpath(self): ''' path as Part.polygon ''' FreeCAD.s=self points=self.Object.Proxy.path for p in self.Object.Proxy.path: say(str(p)) pp=Part.makePolygon(points) Part.show(pp) FreeCAD.ActiveDocument.recompute() return FreeCAD.activeDocument().ActiveObject
Example #18
Source File: Trackreader.py From Animation with GNU General Public License v2.0 | 5 votes |
def edit(self): self.dialog=EditWidget(self,self.emenu) self.dialog.show()
Example #19
Source File: reparametrize.py From CurvesWB with GNU Lesser General Public License v2.1 | 5 votes |
def main(): s = FreeCADGui.Selection.getSelectionEx() edges = [] for so in s: for su in so.SubObjects: #subshapes(su) if isinstance(su, Part.Edge): edges.append(su) if not so.HasSubObjects: edges.append(so.Object.Shape.Wires[0]) nc1, nc2 = reparametrize(edges[0], edges[1], 40) com2 = Part.Compound([nc1.toShape(), nc2.toShape()]) Part.show(com2)
Example #20
Source File: fuzzy_wire.py From CurvesWB with GNU Lesser General Public License v2.1 | 5 votes |
def show(closed = False): Part.show(run(closed))
Example #21
Source File: SurfaceEdit.py From CurvesWB with GNU Lesser General Public License v2.1 | 5 votes |
def Activated(self): if not SurfaceEditTool.active: mw = getMainWindow() tab = getComboView(getMainWindow()) tab2=SurfaceEdit() tab.addTab(tab2,"Surface Edit Tool") tab2.show() #zebraWidget.show() SurfaceEditTool.active = True else: FreeCAD.Console.PrintMessage("Tool already active\n")
Example #22
Source File: libS2R.py From CurvesWB with GNU Lesser General Public License v2.1 | 5 votes |
def main(): doc = App.getDocument("test_birail") obj = doc.getObject("Ruled_Surface") face = obj.Shape.Face1 obj = doc.getObject("Spline005") e1 = obj.Shape.Edge1 obj = doc.getObject("Spline006") e2 = obj.Shape.Edge1 obj = doc.getObject("Spline007") e3 = obj.Shape.Edge1 s2r = SweepOn2Rails() s2r.parametrization = 1.0 s2r.fac = 1.0 s2r.profileSamples = 100 s2r.extend = True s2r.setRails(face) s2r.setProfiles([e1,e2,e3]) #((e1,e2,e3)) s2r.build() #s2r.showLocalProfiles() s2r.showInterpoCurves() s2r.mix("Rail1") Part.show(s2r.shape())
Example #23
Source File: gordon.py From CurvesWB with GNU Lesser General Public License v2.1 | 5 votes |
def check_curve_network_compatibility(self): # self.profiles, self.guides, self.intersectionParamsU, self.intersectionParamsV, tol): # find out the 'average' scale of the B-splines in order to being able to handle a more approximate dataset and find its intersections bsa = BSplineAlgorithms(self.par_tol) splines_scale = 0.5 * (bsa.scale(self.profiles) + bsa.scale(self.guides)) if abs(self.intersectionParamsU[0]) > (splines_scale * self.tolerance) or abs(self.intersectionParamsU[-1] - 1.) > (splines_scale * self.tolerance): self.error("WARNING: B-splines in u-direction must not stick out, spline network must be 'closed'!") if abs(self.intersectionParamsV[0]) > (splines_scale * self.tolerance) or abs(self.intersectionParamsV[-1] - 1.) > (splines_scale * self.tolerance): self.error("WARNING: B-splines in v-direction mustn't stick out, spline network must be 'closed'!") # check compatibility of network #ucurves = list() #vcurves = list() debug("check_curve_network_compatibility") for u_param_idx in range(len(self.intersectionParamsU)): #(size_t u_param_idx = 0; u_param_idx < self.intersectionParamsU.size(); ++u_param_idx) { spline_u_param = self.intersectionParamsU[u_param_idx] spline_v = self.guides[u_param_idx] #vcurves.append(spline_v.toShape()) for v_param_idx in range(len(self.intersectionParamsV)): #(size_t v_param_idx = 0; v_param_idx < self.intersectionParamsV.size(); ++v_param_idx) { spline_u = self.profiles[v_param_idx] #ucurves.append(spline_u.toShape()) spline_v_param = self.intersectionParamsV[v_param_idx] #debug("spline_u_param, spline_v_param = %0.5f,%0.5f"%(spline_u_param, spline_v_param)) p_prof = spline_u.value(spline_u_param) p_guid = spline_v.value(spline_v_param) #debug("p_prof, p_guid = %s,%s"%(p_prof, p_guid)) distance = p_prof.distanceToPoint(p_guid) #debug("distance = %f"%(distance)) if (distance > splines_scale * self.tolerance): self.error("\nB-spline network is incompatible (e.g. wrong parametrization) or intersection parameters are in a wrong order!") self.error("\nprofile {} - guide {}".format(u_param_idx, v_param_idx)) #Part.show(Part.Compound(ucurves)) #Part.show(Part.Compound(vcurves))
Example #24
Source File: nurbs_surface_match.py From CurvesWB with GNU Lesser General Public License v2.1 | 5 votes |
def main(): doc = FreeCAD.getDocument("Gordon_1") loft = doc.getObject("Loft") profloft = loft.Shape.Face1 inter = doc.getObject("Shape") interpts = inter.Shape.Face1 loft2 = doc.getObject("Ruled_Surface") railloft = loft2.Shape.Face1 surf1 = profloft.Surface.copy() surf2 = railloft.Surface.copy() surf3 = interpts.Surface.copy() surf1.exchangeUV() matchSurfaces(surf1, surf2) matchSurfaces(surf2, surf3) matchSurfaces(surf3, surf1) checkPoles([surf1,surf2,surf3]) # Now, the 3 surfaces should have identical topologies (same degrees, knots, mults) # Only their poles, weights are different poles1 = addPoles(surf1.getPoles(), surf2.getPoles()) poles2 = subPoles(poles1, surf3.getPoles()) gordon = surf1.copy() for i in range(len(poles2)): gordon.setPoleRow(i+1, poles2[i]) Part.show(surf1.toShape()) Part.show(surf2.toShape()) Part.show(surf3.toShape()) Part.show(gordon.toShape())
Example #25
Source File: grid2.py From CurvesWB with GNU Lesser General Public License v2.1 | 5 votes |
def draw_box(): #pts = [getPoint(-0.5,-0.5), getPoint(0.5,-0.5), getPoint(0.5,0.5), getPoint(-0.5,0.5), getPoint(-0.5,-0.5)] pts = [getPoint(0,0), getPoint(1,0), getPoint(1,1), getPoint(0,1), getPoint(0,0)] poly = Part.makePolygon(pts) Part.show(poly)
Example #26
Source File: flextab.py From LCInterlocking with GNU Lesser General Public License v2.1 | 5 votes |
def make_rounded_shape(material_face, material_plane, width, pos_y, use_laser_kerf = True): part_thickness = material_face.thickness other_part_thickness_with_tolerance = material_plane.thickness + material_plane.thickness_tolerance corrected_width = width if use_laser_kerf: corrected_width = corrected_width + material_face.laser_beam_diameter half_width = corrected_width / 2.0 z = part_thickness/2.0 th = other_part_thickness_with_tolerance p1 = FreeCAD.Vector(0., -half_width, z) p2 = FreeCAD.Vector(0.3 * th, -half_width, z) cp2_1 = FreeCAD.Vector(0.9 * th, -half_width, z) p3 = FreeCAD.Vector(0.9 * th, 0, z) cp3_1 = FreeCAD.Vector(0.9 * th, half_width / 4.0, z) cp3_2 = FreeCAD.Vector(1.6 * th, half_width / 4.0, z) p4 = FreeCAD.Vector(1.6 * th, half_width / 2.0, z) p5 = FreeCAD.Vector(1.6 * th, half_width, z) cp5_1 = FreeCAD.Vector(1.6 * th, 1.2 * half_width, z) p6 = FreeCAD.Vector(1.04 * th, 1.2 * half_width, z) p7 = FreeCAD.Vector(th, half_width, z) p8 = FreeCAD.Vector(0, half_width, z) l1 = Part.Line(p1, p2) c2 = make_bezier_curve([p2, cp2_1, p3]) c3 = make_bezier_curve([p3, cp3_1, cp3_2, p4]) l4 = Part.Line(p4, p5) c5 = make_bezier_curve([p5, cp5_1, p6]) l6 = Part.Line(p6, p7) l7 = Part.Line(p7, p8) l8 = Part.Line(p8, p1) shape = Part.Shape([l1, c2, c3, l4, c5, l6, l7, l8]) wire = Part.Wire(shape.Edges) face = Part.Face(wire) part = face.extrude(FreeCAD.Vector(0, 0, -part_thickness)) part.translate(FreeCAD.Vector(0, pos_y, 0)) #Part.show(part) return part
Example #27
Source File: reparametrize.py From CurvesWB with GNU Lesser General Public License v2.1 | 5 votes |
def show_lines(e1, e2, params, title=""): lines = list() for q1,q2 in params: lines.append(Part.makeLine(e1.valueAt(q1), e2.valueAt(q2))) com = Part.Compound(lines) Part.show(com, title)
Example #28
Source File: dev_Development.py From NodeEditor with MIT License | 5 votes |
def run_FreeCAD_Toy3(self): # testdaten fuer toponaming pts=[ [0,0,0],[10,0,0],[10,5,0],[0,5,0], [0,0,15],[10,0,15],[10,5,15],[0,5,10] ] if 1: [A,B,C,D,E,F,G,H]=[FreeCAD.Vector(p) for p in pts] col=[Part.makePolygon(l) for l in [[A,B],[B,C],[C,D],[D,A], [E,F],[F,G],[G,H],[H,E], [A,E],[B,F],[C,G],[D,H]]] Part.show(Part.Compound(col))
Example #29
Source File: makehinges.py From LCInterlocking with GNU Lesser General Public License v2.1 | 5 votes |
def create_solid_corner(hinge): inner_arc_point = hinge.arc_middle_segment.B outter_arc_point = hinge.arc_middle_segment.A l1 = Part.makeLine(hinge.seg_face_1.A, hinge.seg_face_1.B) a2 = Part.Arc(hinge.seg_face_1.B, inner_arc_point, hinge.seg_face_2.B).toShape() l3 = Part.makeLine(hinge.seg_face_2.B, hinge.seg_face_2.A) a4 = Part.Arc(hinge.seg_face_2.A, outter_arc_point, hinge.seg_face_1.A).toShape() wire = Part.Wire([l1, a2, l3, a4]) face = Part.Face(wire) hinge.solid = face.extrude(hinge.extrustion_vector) #Part.show(hinge.solid) return
Example #30
Source File: dev.py From NodeEditor with MIT License | 5 votes |
def createToy(): countA=11 countB=11 degA=3 degB=3 poles=np.zeros(countA*countB*3).reshape(countA,countB,3) for u in range(countA): for v in range(countB): poles[u,v,0]=10*u poles[u,v,1]=10*v poles[1:-1,:,2]=30 poles[2:-2,:,2]=60 poles[3:8,3:8,2]=180 poles[4,4,2]=150 poles[6,4,2]=220 multA=[degA+1]+[1]*(countA-1-degA)+[degA+1] multB=[degB+1]+[1]*(countB-1-degB)+[degB+1] knotA=range(len(multA)) knotB=range(len(multB)) sf=Part.BSplineSurface() sf.buildFromPolesMultsKnots(poles,multA,multB,knotA,knotB,False,False,degA,degB) shape=sf.toShape() Part.show(shape)