Skip to content

Commit

Permalink
Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jan 5, 2014
2 parents 847b6b7 + 9c3d1a8 commit 33e6c39
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
24 changes: 16 additions & 8 deletions src/Mod/Arch/importIFC.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)]
Expand Down
8 changes: 7 additions & 1 deletion src/Mod/Draft/Draft.py
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 33e6c39

Please sign in to comment.