Exemple #1
0
def getPlacement(entity):
    "returns a placement from the given entity"
    if DEBUG: print "getting placement ", entity
    if not entity: return None
    pl = None
    if entity.type == "IFCAXIS2PLACEMENT3D":
        x = getVector(entity.RefDirection)
        z = getVector(entity.Axis)
        y = z.cross(x)
        loc = getVector(entity.Location)
        m = fcvec.getPlaneRotation(x, y, z)
        pl = FreeCAD.Placement(m)
        pl.move(loc)
    elif entity.type == "IFCLOCALPLACEMENT":
        pl = getPlacement(entity.PlacementRelTo)
        relpl = getPlacement(entity.RelativePlacement)
        if pl and relpl:
            pl = relpl.multiply(pl)
        elif relpl:
            pl = relpl
    elif entity.type == "IFCCARTESIANPOINT":
        loc = getVector(entity)
        pl = FreeCAD.Placement()
        pl.move(loc)
    if DEBUG: print "made placement for", entity.id, ":", pl
    return pl
Exemple #2
0
def getPlacement(entity):
    "returns a placement from the given entity"
    if DEBUG:
        print "getting placement ", entity
    if not entity:
        return None
    pl = None
    if entity.type == "IFCAXIS2PLACEMENT3D":
        x = getVector(entity.RefDirection)
        z = getVector(entity.Axis)
        y = z.cross(x)
        loc = getVector(entity.Location)
        m = fcvec.getPlaneRotation(x, y, z)
        pl = FreeCAD.Placement(m)
        pl.move(loc)
    elif entity.type == "IFCLOCALPLACEMENT":
        pl = getPlacement(entity.PlacementRelTo)
        relpl = getPlacement(entity.RelativePlacement)
        if pl and relpl:
            pl = relpl.multiply(pl)
        elif relpl:
            pl = relpl
    elif entity.type == "IFCCARTESIANPOINT":
        loc = getVector(entity)
        pl = FreeCAD.Placement()
        pl.move(loc)
    if DEBUG:
        print "made placement for", entity.id, ":", pl
    return pl
Exemple #3
0
 def getRotation(self):
     "returns a placement describing the working plane orientation ONLY"
     m = fcvec.getPlaneRotation(self.u, self.v, self.axis)
     return FreeCAD.Placement(m)
Exemple #4
0
 def getRotation(self):
         "returns a placement describing the working plane orientation ONLY"
         m = fcvec.getPlaneRotation(self.u,self.v,self.axis)
         return FreeCAD.Placement(m)