Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
wmayer 2014-01-05 11:26:43 +01:00
commit 33e6c39f8a
2 changed files with 23 additions and 9 deletions

View File

@ -170,7 +170,10 @@ def read(filename):
objparentid = int(str(getAttr(r,"RelatingBuildingElement")).split("=")[0].strip("#"))
else:
obj = IfcImport.Get()
if hasattr(IfcImport, 'GetBrepData'):
obj = IfcImport.GetBrepData()
else:
obj = IfcImport.Get()
objid = obj.id
idx = objid
objname = obj.name
@ -244,13 +247,18 @@ def read(filename):
else:
# treat as meshes
if DEBUG: print "Warning: Object without shape: ",objid, " ", objtype
me,pl = getMesh(obj)
nobj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",n)
nobj.Label = n
nobj.Mesh = me
nobj.Placement = pl
if DEBUG: print "Warning: Object without shape: ",objid, " ", objtype
if hasattr(obj,"mesh"):
if not hasattr(obj.mesh, 'verts'):
obj = IfcImport.Get() # Get triangulated rep of same product
me,pl = getMesh(obj)
nobj = FreeCAD.ActiveDocument.addObject("Mesh::Feature",n)
nobj.Label = n
nobj.Mesh = me
nobj.Placement = pl
else:
if DEBUG: print "Error: Skipping object without mesh: ",objid, " ", objtype
# registering object number and parent
if objparentid > 0:
ifcParents[objid] = [objparentid,not (objtype in subtractiveTypes)]

View File

@ -1995,7 +1995,9 @@ def makeSketch(objectslist,autoconstraints=False,addTo=None,delete=False,name="S
return nobj
def makePoint(X=0, Y=0, Z=0,color=None,name = "Point", point_size= 5):
''' make a point (at coordinates x,y,z ,color(r,g,b),point_size)
''' makePoint(x,y,z ,[color(r,g,b),point_size]) or
makePoint(Vector,color(r,g,b),point_size]) -
creates a Point in the current document.
example usage:
p1 = makePoint()
p1.ViewObject.Visibility= False # make it invisible
@ -2006,6 +2008,10 @@ def makePoint(X=0, Y=0, Z=0,color=None,name = "Point", point_size= 5):
p1.ViewObject.PointColor =(0.0,0.0,1.0) #change the color-make sure values are floats
'''
obj=FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
if isinstance(X,FreeCAD.Vector):
Z = X.z
Y = X.y
X = X.x
_Point(obj,X,Y,Z)
obj.X = X
obj.Y = Y