# -*- coding: utf-8 -*-
import FreeCAD
import Part
import Part,PartGui
from FreeCAD import Base
def kansu(i):
b=1
h=0.5
myWedgei='myPyramid' + str(i)
pyramid=App.ActiveDocument.addObject("Part::Wedge",myWedgei)
pyramid.Xmin=0.00
pyramid.Ymin=0.00
pyramid.Zmin=0.00
pyramid.X2min=b/2
pyramid.Z2min=b/2
pyramid.Xmax=b
pyramid.Ymax=h
pyramid.Zmax=b
pyramid.X2max=b/2
pyramid.Z2max=b/2
pyramid.Placement=Base.Placement(Base.Vector(0.00,0.00,0.00),Base.Rotation(0.00,0.00,0.00,1.00))
pyramid.Placement=App.Placement(App.Vector(i*2,0,0), App.Rotation(App.Vector(1,0,0),90), App.Vector(0,0,0))
pyramid.recompute()
kansu(1)
kansu(2)
why 1pyramid?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- wandererfan
- Veteran
- Posts: 6324
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: why 1pyramid?
code tags, please. too hard to read without them
Code: Select all
# -*- coding: utf-8 -*-
import FreeCAD
import Part
import Part,PartGui
from FreeCAD import Base
def kansu(i):
b=1
h=0.5
myWedgei='myPyramid' + str(i)
pyramid=App.ActiveDocument.addObject("Part::Wedge",myWedgei)
pyramid.Xmin=0.00
pyramid.Ymin=0.00
pyramid.Zmin=0.00
pyramid.X2min=b/2
pyramid.Z2min=b/2
pyramid.Xmax=b
pyramid.Ymax=h
pyramid.Zmax=b
pyramid.X2max=b/2
pyramid.Z2max=b/2
pyramid.Placement=Base.Placement(Base.Vector(0.00,0.00,0.00),Base.Rotation(0.00,0.00,0.00,1.00))
pyramid.Placement=App.Placement(App.Vector(i*2,0,0), App.Rotation(App.Vector(1,0,0),90), App.Vector(0,0,0))
pyramid.recompute()
kansu(1)
kansu(2)
OS: Ubuntu 12.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13374 (Git)
Build type: debug
Branch: wmWidget
Hash: c5bc81ce59522a3b0f886f844d46fc3771d89080
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
OCC version: 7.2.0
Locale: English/Canada (en_CA)
Re: why 1pyramid?
Thanks
--------------
(2018/03/13)
wrong top x0.5 y0.5
Code: Select all
# -*- coding: utf-8 -*-
import FreeCAD
import Part
import Part,PartGui
from FreeCAD import Base
def kansu(i):
b=1
h=0.5
myWedgei='myPyramid' + str(i)
pyramid=App.ActiveDocument.addObject("Part::Wedge",myWedgei)
pyramid.Xmin=0.00
pyramid.Ymin=0.00
pyramid.Zmin=0.00
pyramid.X2min=b/2
pyramid.Z2min=b/2
pyramid.Xmax=b
pyramid.Ymax=h
pyramid.Zmax=b
pyramid.X2max=b/2
pyramid.Z2max=b/2
pyramid.Placement=Base.Placement(Base.Vector(0.00,0.00,0.00),Base.Rotation(0.00,0.00,0.00,1.00))
pyramid.Placement=App.Placement(App.Vector(i*2,0,0), App.Rotation(App.Vector(1,0,0),90), App.Vector(0,0,0))
kansu(1)
kansu(2)
pyramid.recompute()
(2018/03/13)
Code: Select all
# -*- coding: utf-8 -*-
import FreeCAD
import Part
import Part,PartGui
from FreeCAD import Base
def fcPyramid(x,y,b,h):
myWedgei='myPyramid_x' + str(x) + 'y' + str(y)
y=y+b
pyramid=App.ActiveDocument.addObject("Part::Wedge",myWedgei)
pyramid.Xmin=0.00
pyramid.Ymin=0.00
pyramid.Zmin=0.00
pyramid.X2min=b/2
pyramid.Z2min=b/2
pyramid.Xmax=b
pyramid.Ymax=h
pyramid.Zmax=b
pyramid.X2max=b/2
pyramid.Z2max=b/2
pyramid.Placement=Base.Placement(Base.Vector(0.00,0.00,0.00),Base.Rotation(0.00,0.00,0.00,1.00))
pyramid.Placement=App.Placement(App.Vector(x,y,0), App.Rotation(App.Vector(1,0,0),90), App.Vector(0,0,0))
b=1
h=0.5
fcPyramid(0,0,b,h)
pyramid.recompute()