本文整理汇总了Python中Part.show方法的典型用法代码示例。如果您正苦于以下问题:Python Part.show方法的具体用法?Python Part.show怎么用?Python Part.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cylindricprojection
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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))
#--------------------------
示例2: makeSquareTool
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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
示例3: sew_Shape
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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')
示例4: doubleClicked
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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()
#---------------------------------------------------------------
示例5: showimage
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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)
示例6: main
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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())
示例7: show
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
def show(closed = False):
Part.show(run(closed))
示例8: Activated
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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")
示例9: check_curve_network_compatibility
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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))
示例10: main
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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())
示例11: draw_box
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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)
示例12: show_lines
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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)
示例13: main
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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)
示例14: run_FreeCAD_Toy3
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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))
示例15: createToy
# 需要导入模块: import Part [as 别名]
# 或者: from Part import show [as 别名]
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)