Example #1
0
	def runmode3(self,fp):

		fn=fp.source.Shape.Faces[fp.faceNumber-1]
		sf=fn.toNurbs().Face1.Surface

		if fp.ref == None: return

		(sob,subo)=fp.ref

		if len(subo)==1:
			subobj=getattr(sob.Shape,subo[0])
			try:
				p=subobj.CenterOfMass
			except:
				p=subobj.Point
		else:
			p=sob.Shape.CenterOfMass



		if fp.modeRef=='vertical':

			line=App.ActiveDocument.addObject("Part::Line","_tmp_Line")
			line.X1,line.Y1,line.Z1=p.x,p.y,10**4
			line.X2,line.Y2,line.Z2=p.x,p.y,-10**4

			a2=App.ActiveDocument.BePlane.Shape
			a3=line.Shape.section(a2.Face1)
			p2=a3.Vertexes[0].Point
			App.ActiveDocument.removeObject(line.Name)

		else:
			p2=sf.value(*sf.parameter(p))

		l=(p2-p).Length
		col=[]

		if fp.mode=="Circles1":
			for i in range(10):
				aa=Part.Sphere()
				aa.Radius=l+(i)*0.2*100
				a2=aa.toShape()
				a2.Placement.Base=p
				a3=fn.section(a2.Face1)
				col += [a3]

		if fp.mode=="Circles2":

			aa=App.ActiveDocument.addObject("Part::Cylinder","Cylinder")

			for i in range(10):	
				aa.Height=10000
				aa.Radius=0.2*i*100
				aa.Placement.Base=p
				aa.Placement.Rotation=FreeCAD.Rotation(FreeCAD.Vector(0,0,1),p2-p)
				fc=aa.Shape.Face1
				a3=fn.section(fc)
				col += [a3]

			App.ActiveDocument.removeObject(aa.Name)

		if len(col)==0:
			fp.Shape=Part.Point().toShape()
		else:
			fp.Shape=Part.Compound(col)

		(u,v) = sf.parameter(p2)
		[umi,uma,vmi,vma]=fn.toNurbs().Face1.ParameterRange
		fp.u=(u-umi)/(uma-umi)*fp.scale
		fp.v=(v-vmi)/(vma-vmi)*fp.scale