RegularTetrahedron dim can not

Need help, or want to share a macro? Post here!
mrrclb48z
Posts: 27
Joined: Wed Feb 07, 2018 11:20 am

RegularTetrahedron dim can not

Postby mrrclb48z » Wed Apr 11, 2018 1:32 pm

What am I doing wrong with the macro?

full script :

Code: Select all

# -*- coding: utf-8 -*-
import FreeCAD
import Part
import DraftTools
import Draft
def myRegularTetrahedron(x,y,b,h):
       z=0
       p1 = FreeCAD.Vector(x,y,z)
       p2 = FreeCAD.Vector(x+b,y,z)
       p3 = FreeCAD.Vector(x+b,y+b,z)
       p4 = FreeCAD.Vector(x,y+b,z)
       z=h
       p5 = FreeCAD.Vector(x,y,z)
       p6 = FreeCAD.Vector(x+b,y,z)
       p7 = FreeCAD.Vector(x+b,y+b,z)
       p8 = FreeCAD.Vector(x,y+b,z)

       w1 = Draft.makeWire([p3, p6, p8], closed=True, face=True, support=None)
       w2 = Draft.makeWire([p1, p6, p8], closed=True, face=True, support=None)
       w3 = Draft.makeWire([p1, p3, p8], closed=True, face=True, support=None)
       w4 = Draft.makeWire([p1, p3, p6], closed=True, face=True, support=None)
       myWedgei='myRegularTetrahedron_x' + str(x) + 'y' + str(y) 
       fuse = App.activeDocument().addObject("Part::MultiFuse",myWedgei)
       fuse.Shapes = [w1, w2, w3, w4]
       myText = Draft.makeText("p1",p1) 
       myText.Label = "p1"
       myText = Draft.makeText("p3",p3) 
       myText.Label = "p3"
       myText = Draft.makeText("p6",p6) 
       myText.Label = "p6"
       myText = Draft.makeText("p8",p8) 
       myText.Label = "p8"
       # error?
       #makeDimension(p1,p6) 

b=10
h=10
myRegularTetrahedron(0,0,b,h)
#myRegularTetrahedron(20,0,b,h)
#
App.ActiveDocument.recompute()
Gui.activeDocument().activeView().viewAxonometric()
Gui.SendMsgToActiveView("ViewFit")
Last edited by mrrclb48z on Wed May 02, 2018 7:28 am, edited 1 time in total.
chrisb
Posts: 27162
Joined: Tue Mar 17, 2015 9:14 am

Re: RegularTetrahedron dim can not

Postby chrisb » Wed Apr 11, 2018 5:03 pm

Sorry for not contributing to your question.

The code tag seems not working any longer.
kkremitzki wrote:
Wed Apr 11, 2018 11:11 am
ping