I can not understand Dwire NO? Text NO?
I need (Dwire and Text) count? (For each function call)
Sorry for weird English
What am I doing wrong with the (new)macro?
output:
Label="myPyramid_x0y5(Text)",Text="myPyramid_x0y0"
Label="Text001,Label" ,Text="myPyramid_x0y5"
Code: Select all
# -*- coding: utf-8 -*-
import FreeCAD
import Part
import DraftTools
import Draft
def myPyramid(x,y,b,h):
x1=x
y1=y
z1=0
x2=x+b
y2=y
z2=0
x3=x+b
y3=y+b
z3=0
x4=x
y4=y+b
z4=0
x5=x+b*.5
y5=y+b*.5
z5=h
points=[FreeCAD.Vector(x1,y1,z1),FreeCAD.Vector(x2,y2,z2),FreeCAD.Vector(x3,y3,z3),FreeCAD.Vector(x4,y4,z4)]
w1 = Draft.makeWire(points,closed=True,face=True,support=None)
points=[FreeCAD.Vector(x1,y1,z1),FreeCAD.Vector(x2,y2,z2),FreeCAD.Vector(x5,y5,z5)]
w2 = Draft.makeWire(points,closed=True,face=True,support=None)
points=[FreeCAD.Vector(x2,y2,z2),FreeCAD.Vector(x3,y3,z3),FreeCAD.Vector(x5,y5,z5)]
w3 = Draft.makeWire(points,closed=True,face=True,support=None)
points=[FreeCAD.Vector(x3,y3,z3),FreeCAD.Vector(x4,y4,z4),FreeCAD.Vector(x5,y5,z5)]
w4 = Draft.makeWire(points,closed=True,face=True,support=None)
points=[FreeCAD.Vector(x4,y4,z4),FreeCAD.Vector(x1,y1,z1),FreeCAD.Vector(x5,y5,z5)]
w5 = Draft.makeWire(points,closed=True,face=True,support=None)
myWedgei='myPyramid_x' + str(x) + 'y' + str(y)
fuse = App.activeDocument().addObject("Part::MultiFuse",myWedgei)
fuse.Shapes = [w1, w2, w3, w4, w5]
# https://forum.freecadweb.org/viewtopic.php?f=22&t=27765
Draft.makeText(myWedgei,FreeCAD.Vector(x5,y5,z5))
mvo = App.ActiveDocument.Text.ViewObject
FreeCAD.getDocument("MeishoMisette").getObject("Text").Label = myWedgei + "(Text)"
#
b=1
h=1
myPyramid(0,0,b,h)
myPyramid(0,5,b,h)
App.ActiveDocument.recompute()
Gui.activeDocument().activeView().viewAxonometric()
Gui.SendMsgToActiveView("ViewFit")