当前位置: 首页>>代码示例>>Python>>正文


Python Draft.makeWire方法代码示例

本文整理汇总了Python中Draft.makeWire方法的典型用法代码示例。如果您正苦于以下问题:Python Draft.makeWire方法的具体用法?Python Draft.makeWire怎么用?Python Draft.makeWire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Draft的用法示例。


在下文中一共展示了Draft.makeWire方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _drawquadrangle

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def _drawquadrangle(rect):
	# reihenfolge empfildlich

#	for l in rect:
#		l.ViewObject.LineColor=(0.7,.0,.0)

	[a1,a2]=endpunktev2(rect[0])
	[b1,b2]=endpunktev2(rect[1])
	[c1,c2]=endpunktev2(rect[2])
	[d1,d2]=endpunktev2(rect[3])

	SA=schnittpunkt(a1,a2,b1,b2)
	SB=schnittpunkt(b1,b2,c1,c2)
	SC=schnittpunkt(c1,c2,d1,d2)
	SD=schnittpunkt(d1,d2,a1,a2)
	points=[vec(SA),vec(SB),vec(SC),vec(SD)]
	w=Draft.makeWire(points,closed=True,face=True,support=None)
	return w 
开发者ID:microelly2,项目名称:reconstruction,代码行数:20,代码来源:projectiontools.py

示例2: drawboundbox

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def drawboundbox():
	sels=Gui.Selection.getSelection()
	xmin=1e+10
	xmax=-1e+10
	zmin=1e+10
	zmax=-1e+10
	for e in sels:
		xmin=min(xmin,e.Shape.BoundBox.XMin)
		xmax=max(xmax,e.Shape.BoundBox.XMax)
		zmin=min(zmin,e.Shape.BoundBox.ZMin)
		zmax=max(zmax,e.Shape.BoundBox.ZMax)

	points=[FreeCAD.Vector(xmin,0,zmin),FreeCAD.Vector(xmax,0,zmin),
		FreeCAD.Vector(xmax,0,zmax),FreeCAD.Vector(xmin,0,zmax),]
	w=Draft.makeWire(points,closed=True,face=True,support=None)
	return w 
开发者ID:microelly2,项目名称:reconstruction,代码行数:18,代码来源:projectiontools.py

示例3: testE

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def testE():
	[uv2x,uv2y,xy2u,xy2v]=getmap(face)
	ptbb=[]
	for p in FreeCAD.ptsaa:
		(u,v)=bs.parameter(p)
		(u,v)=bs.parameter(p)
		pt0=bs.value(u,v)
#		print (u,v)
		x=uv2x(u,v)
		y=uv2y(u,v)
#		print (x,y)
		u=xy2v(x,y)
		v=xy2u(x,y)
#		print(u,v)
		pt=bs.value(u,v)
	#	print pt
	#	print p
		print p-pt
		ptbb.append(pt)

	Draft.makeWire(ptbb) 
开发者ID:microelly2,项目名称:freecad-nurbs,代码行数:23,代码来源:isodraw.py

示例4: runtest

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def runtest():

	import Draft

	if FreeCAD.ActiveDocument == None:
		FreeCAD.newDocument("Unbenannt")
		FreeCAD.setActiveDocument("Unbenannt")
		FreeCAD.ActiveDocument=FreeCAD.getDocument("Unbenannt")
	
	points=[FreeCAD.Vector(-30,0.0,0.0),FreeCAD.Vector(-20,30,0.0),FreeCAD.Vector(20,40,0.0),
		FreeCAD.Vector(40,-20,0.0),FreeCAD.Vector(150,-20,0.0),FreeCAD.Vector(190,80,0.0)]


	a=makeMySpline()
	a.wire=Draft.makeWire(points,closed=False,face=True,support=None)

	a.Tangents='1 0 0,1 0 0,1 1 0,1 0 0,1 0 0,-1 0 0'.split(',')
	a.TangentFlags=['0','1','1','0','0','1']

	FreeCAD.activeDocument().recompute()
	FreeCADGui.SendMsgToActiveView("ViewFit") 
开发者ID:microelly2,项目名称:freecad-nurbs,代码行数:23,代码来源:param_bspline.py

示例5: dist

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def  dist(a,b):

	[a,b]=[b,a]
	ptas=a.Shape.Edge1.Curve.discretize(100)
	cb=b.Shape.Edge1.Curve

	pts=[]
	ls=[]
	for pa in ptas:
		pm=cb.parameter(pa)
		v=cb.value(pm)
		ls.append((v-pa).Length**2)
		pts.append(v)

#	Draft.makeWire(pts)
#	Draft.makeWire(ptas)

	ls=np.array(ls)
#	print ls
	ls.min()
	ls.max()
#	print (ls.max(),ls.min(),ls.mean())
	return ls.mean() 
开发者ID:microelly2,项目名称:freecad-nurbs,代码行数:25,代码来源:curvedistance.py

示例6: drawface

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def drawface():
	# auswertuing verbessern:  punkte /kanten in reihenfolge
	sels=Gui.Selection.getSelection()
	points=[]
	for e in sels:
		points.append(e.Shape.Vertexes[0].Point)
		#print e
		#print e.Point

	w=Draft.makeWire(points,closed=True,face=True,support=None)
	return w 
开发者ID:microelly2,项目名称:reconstruction,代码行数:13,代码来源:projectiontools.py

示例7: testD

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def testD():
#	kku2=np.array(FreeCAD.kku).reshape(31,31,3)
#	kku=kku2[10:25,10:20].reshape(150,3)

	ptsu=[FreeCAD.Vector(tuple(i)) for i in kku]
	Draft.makeWire(ptsu)
	Points.show(Points.Points(ptsu))


	mode='thin_plate'
	xy2u = scipy.interpolate.Rbf(kku[:,0],kku[:,1],kku[:,2], function=mode) 
开发者ID:microelly2,项目名称:freecad-nurbs,代码行数:13,代码来源:isodraw.py

示例8: run

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def run():



	[a]=Gui.Selection.getSelectionEx()
	bc0=a.Object.Shape.Edge1.Curve
	kc=len(bc0.getKnots())

	for pos in range(1,kc):
		print pos
		#for t in (30000,40000,10000,5000,2000,1000,500,200,100,50,20,10,5,3,2,1):
		# 1.5 und 1 gehen nicht 
		for t in (20,16,14,12,6,2,1.5,1):
			bc=bc0.copy()
			print "huhu"
			rc=bc.removeKnot(pos,0,t)
			print (t,rc)
			if rc:
				sp=App.ActiveDocument.addObject("Part::Spline","approx Spline")
				sp.Shape=bc.toShape()
				App.ActiveDocument.ActiveObject.Label="BC-"+str(pos)+" "+str(t)+" "+ a.Object.Label

			#	pts=bc.getPoles()
			#	print len(pts)
			#	Draft.makeWire(pts)
			#	App.ActiveDocument.ActiveObject.Label="W-"+str(pos)+" "+a.Object.Label
				if 0:
					pts=[bc.value(k) for k in bc.getKnots()]
			#		print len(pts)
					Draft.makeWire(pts)
					App.ActiveDocument.ActiveObject.Label="Kn " +str(t)+a.Object.Label
					App.ActiveDocument.ActiveObject.ViewObject.PointSize=12
					App.ActiveDocument.ActiveObject.ViewObject.PointColor=(0.,1.,0.) 
开发者ID:microelly2,项目名称:freecad-nurbs,代码行数:35,代码来源:removeknot.py

示例9: makePlane

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def makePlane(p1,p2,p3,p4):

	sp1=Point3D(seq(p1))
	sp2=Point3D(seq(p2))
	sp3=Point3D(seq(p3))
	sp4=Point3D(seq(p4))


	mp=(sp1+sp2+sp3+sp4)/4

	e4=Plane(sp1,sp2,sp3)
	e3=Plane(sp1,sp2,sp4)
	e2=Plane(sp1,sp4,sp3)
	e1=Plane(sp4,sp2,sp3)

	n=Point3D(e1.normal_vector)+Point3D(e2.normal_vector)+Point3D(e3.normal_vector)+Point3D(e3.normal_vector)
	e=Plane(mp,n)
	m=e.p1

	fm=FreeCAD.Vector(m.x.evalf(),m.y.evalf(),m.z.evalf())
	fn=FreeCAD.Vector(n[0],n[1],n[2])

	x=fm.cross(fn).normalize()
	y=x.cross(fn).normalize()

	Draft.makeWire([fm.add(x.multiply(10)),fm.add(y.multiply(10)),fm.sub(x),fm.sub(y)],closed=True,face=True)

	w=Draft.makeWire([p1,p2,p3],closed=True,face=True)
	w.ViewObject.Transparency=80
	w.ViewObject.ShapeColor=(0.,1.,0.)
	w=Draft.makeWire([p4,p2,p3],closed=True,face=True)
	w.ViewObject.Transparency=80
	w.ViewObject.ShapeColor=(0.,1.,0.)
	w=Draft.makeWire([p1,p4,p3],closed=True,face=True)
	w.ViewObject.Transparency=80
	w.ViewObject.ShapeColor=(0.,1.,0.)
	w=Draft.makeWire([p1,p2,p4],closed=True,face=True)
	w.ViewObject.Transparency=80
	w.ViewObject.ShapeColor=(0.,1.,0.)
	
	for p in [p1,p2,p3,p4]:
		k1=App.ActiveDocument.addObject("Part::Sphere","Sphere")
		k1.Placement.Base=p
		k1.Radius=0.5
		k1.ViewObject.ShapeColor=(1.0,0.0,0.0)
		App.activeDocument().recompute() 
开发者ID:microelly2,项目名称:reconstruction,代码行数:48,代码来源:makePlane.py

示例10: showFace

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def showFace(rbf,rbf2,x,y,gridsize,shapeColor,bound):

	import Draft
	grids=gridsize

	ws=[]

	pts2=[]
	xi, yi = np.linspace(np.min(x), np.max(x), grids), np.linspace(np.min(y), np.max(y), grids)

	for ix in xi:
		points=[]
		for iy in yi:
#			print (ix,iy, rbf(ix,iy))
			iz=float(rbf(ix,iy))

#---------------------- special hacks #+#
			if bound>0:
				if iz > bound: iz = bound
				if iz < -bound: iz = -bound
#			print (ix,iy,iz)
#			if abs(ix)>20 or abs(iy)>20: 
#					iz=0

#			if ix==np.max(x) or ix==np.min(x) or iy==np.max(y) or iy==np.min(y): 
#					iz=0

#---------------------- end hack 


#			if rbf2<>None:
#				iz -= float(rbf2(ix,iy))

			points.append(FreeCAD.Vector(iy,ix,iz))
		w=Draft.makeWire(points,closed=False,face=False,support=None)
		ws.append(w)
		pts2.append(points)

#-		FreeCAD.activeDocument().recompute()
#-		FreeCADGui.updateGui()
#-		Gui.SendMsgToActiveView("ViewFit")

	ll=FreeCAD.activeDocument().addObject('Part::Loft','elevation')
	ll.Sections=ws
	ll.Ruled = True
	ll.ViewObject.ShapeColor = shapeColor
	ll.ViewObject.LineColor = (0.00,0.67,0.00)

	for w in ws:
		w.ViewObject.Visibility=False


	ll.Label="Interpolation Gitter " + str(grids)

	bs=Part.BSplineSurface()
#	print "Points --"
#	print pts2
	bs.interpolate(pts2)
	Part.show(bs.toShape()) 
开发者ID:microelly2,项目名称:reconstruction,代码行数:61,代码来源:elevationgrid.py

示例11: run_test_1

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def run_test_1(obj,bs,uv2x,uv2y,fx,fy,refpos):
	'''testmethode'''
	
	ptss=[]
	ptsk=[]

	for a in range(21):

		um=1./20*a
		vm=0.7/20*a
		y=uv2y(vm,um)
		x=uv2x(vm,um)
		ptss.append(FreeCAD.Vector(fx*x,fy*y,0))
		ptsk.append(bs.value(um,vm))

	w1=Draft.makeWire(ptss)
	w1.Placement.Base=refpos
	w1.Label="Map uv-line"
	w1.ViewObject.LineColor=(1.,0.,1.)

	w2=Draft.makeWire(ptsk)
	w2.Label="uv-line"
	w2.ViewObject.LineColor=(1.,0.,1.)


	ptss=[]
	ptsk=[]


	for a in range(21):
		um=0.7+ 0.3*np.sin(2*np.pi*a/20)
		vm=0.5+ 0.5*np.cos(2*np.pi*a/20)

		y=uv2y(vm,um)
		x=uv2x(vm,um)
		ptss.append(FreeCAD.Vector(fx*x,fy*y,0))
		ptsk.append(bs.value(um,vm))

	w1=Draft.makeWire(ptss)
	w1.Label="Map uv-circle"
	w1.Placement.Base=refpos
	w1.ViewObject.LineColor=(1.,0.,0.)

	w2=Draft.makeWire(ptsk)
	w2.Label="uv-circle"
	w2.ViewObject.LineColor=(1.,0.,0.) 
开发者ID:microelly2,项目名称:freecad-nurbs,代码行数:48,代码来源:isomap.py

示例12: run

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def run():

	#default parameters
	p={
		"count":[1000,'Integer'],
		"radius":[400,'Float'],
		"wave":[100,'Float'],
		"debug":[False,'Boolean'],
	}

	# parameter -----------------
	t=FreeCAD.ParamGet('User parameter:Plugins/nurbs/'+'genrandomdat')
	l=t.GetContents()
	if l==None: l=[]
	for k in l: p[k[1]]=k[2]
	for k in p:
		if p[k].__class__.__name__=='list':
			typ=p[k][1]
			if typ=='Integer':t.SetInt(k,p[k][0]);
			if typ=='Boolean':t.SetBool(k,p[k][0])
			if typ=='String':t.SetString(k,p[k][0])
			if typ=='Float':t.SetFloat(k,p[k][0])
			p[k]=p[k][0]
	#--------------------

	count=p["count"]
	ri=p["wave"]
	rm=p["radius"]

	kaps=np.random.random(count)*2*np.pi
	mmaa=np.random.random(count)*ri*np.cos(kaps*5)*np.cos(kaps*1.3) + rm

	y= np.cos(kaps) * mmaa
	x=np.sin(kaps) * mmaa
	z=np.zeros(count)

	pps=np.array([x,y,z]).swapaxes(0,1)
	goods=[FreeCAD.Vector(tuple(p)) for p in pps]

	Points.show(Points.Points(goods))
	App.ActiveDocument.ActiveObject.ViewObject.ShapeColor=(1.0,0.0,0.0)
	App.ActiveDocument.ActiveObject.ViewObject.PointSize=10

#	Draft.makeWire(goods,closed=True) 
开发者ID:microelly2,项目名称:freecad-nurbs,代码行数:46,代码来源:gen_random_dat.py

示例13: makeW

# 需要导入模块: import Draft [as 别名]
# 或者: from Draft import makeWire [as 别名]
def makeW():
  edges=frameCmd.edges()
  if len(edges)>1:
    # patch for FC 0.17: 
    first=edges[0]
    points=list()
    while len(edges)>1: points.append(frameCmd.intersectionCLines(edges.pop(0),edges[0]))
    if edges[0].valueAt(0)==points[-1]: points.append(edges[0].valueAt(edges[0].LastParameter))
    else: points.append(edges[0].valueAt(0))
    if first.valueAt(0)==points[0]: points.insert(0,first.valueAt(first.LastParameter))
    else: points.insert(0,first.valueAt(0)) # END
    #P0=edges[0].valueAt(0)
    #P1=edges[0].valueAt(edges[0].LastParameter)
    #Pint=frameCmd.intersectionCLines(edges[0],edges[1])
    #d0=Pint-P0
    #d1=Pint-P1
    #if d1.Length>d0.Length:
      #P0=P1
    #eds=list()
    #for i in range(len(edges)-1):
      #P1=frameCmd.intersectionCLines(edges[i],edges[i+1])
      #eds.append(Part.Edge(Part.Line(P0,P1)))
      #P0=P1
    #P1=edges[-1].valueAt(edges[-1].LastParameter)
    #P2=edges[-1].valueAt(0)
    #d1=P1-P0
    #d2=P2-P0
    #if d1.Length<d2.Length:
      #P1=P2
    #eds.append(Part.Edge(Part.Line(P0,P1)))
    #for e in eds:
      #print(type(e))
    #w=Part.Wire(eds)
    #points=[e.valueAt(0) for e in w.Edges]
    #last=e.Edges[-1]
    #points.append(last.valueAt(last.LastParameter))
    from Draft import makeWire
    try:
      p=makeWire(points)
    except: 
      FreeCAD.Console.PrintError('Missing intersection\n')
      return None
    p.Label='Path'
    drawAsCenterLine(p)
    return p
  else:
    FreeCAD.Console.PrintError('Not enough edges/n')
    return None 
开发者ID:oddtopus,项目名称:flamingo,代码行数:50,代码来源:pipeCmd.py


注:本文中的Draft.makeWire方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。