Skip to content

Commit

Permalink
Merge branch 'master' into deburrFix
Browse files Browse the repository at this point in the history
  • Loading branch information
dubstar-04 committed Apr 22, 2020
2 parents d0d9888 + 89928ef commit 12fd4de
Show file tree
Hide file tree
Showing 56 changed files with 4,392 additions and 2,158 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Expand Up @@ -6,7 +6,7 @@ open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
liberapay: FreeCAD
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.patreon.com/yorikvanhavre', 'https://www.patreon.com/kkremitzki', 'https://www.patreon.com/thundereal']
12 changes: 6 additions & 6 deletions src/Gui/NaviCube.cpp
Expand Up @@ -974,26 +974,26 @@ void NaviCubeImplementation::drawNaviCube(bool pickMode) {
static GLubyte xbmp[] = { 0x11,0x11,0x0a,0x04,0x0a,0x11,0x11 };
glColor3f(1, 0, 0);
glBegin(GL_LINES);
glVertex3f(-1.1 , -1.1, -1.1);
glVertex3f(+0.5 , -1.1, -1.1);
glVertex3f(-1.1f, -1.1f, -1.1f);
glVertex3f(+0.5f, -1.1f, -1.1f);
glEnd();
glRasterPos3d(a, -a, -a);
glBitmap(8, 7, 0, 0, 0, 0, xbmp);

static GLubyte ybmp[] = { 0x04,0x04,0x04,0x04,0x0a,0x11,0x11 };
glColor3f(0, 1, 0);
glBegin(GL_LINES);
glVertex3f(-1.1 , -1.1, -1.1);
glVertex3f(-1.1 , +0.5, -1.1);
glVertex3f(-1.1f, -1.1f, -1.1f);
glVertex3f(-1.1f, +0.5f, -1.1f);
glEnd();
glRasterPos3d( -a, a, -a);
glBitmap(8, 7, 0, 0, 0, 0, ybmp);

static GLubyte zbmp[] = { 0x1f,0x10,0x08,0x04,0x02,0x01,0x1f };
glColor3f(0, 0, 1);
glBegin(GL_LINES);
glVertex3f(-1.1 , -1.1, -1.1);
glVertex3f(-1.1 , -1.1, +0.5);
glVertex3f(-1.1f, -1.1f, -1.1f);
glVertex3f(-1.1f, -1.1f, +0.5f);
glEnd();
glRasterPos3d( -a, -a, a);
glBitmap(8, 7, 0, 0, 0, 0, zbmp);
Expand Down
15 changes: 3 additions & 12 deletions src/Mod/Arch/Resources/ui/preferences-ifc-export.ui
Expand Up @@ -7,26 +7,17 @@
<x>0</x>
<y>0</y>
<width>463</width>
<height>421</height>
<height>466</height>
</rect>
</property>
<property name="windowTitle">
<string>IFC-Export</string>
<string>IFC export</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>9</number>
</property>
<item>
Expand Down
31 changes: 19 additions & 12 deletions src/Mod/Arch/Resources/ui/preferences-ifc.ui
Expand Up @@ -7,26 +7,17 @@
<x>0</x>
<y>0</y>
<width>463</width>
<height>495</height>
<height>577</height>
</rect>
</property>
<property name="windowTitle">
<string>IFC</string>
<string>IFC import</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>9</number>
</property>
<item>
Expand Down Expand Up @@ -394,6 +385,22 @@ FreeCAD object properties</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox">
<property name="toolTip">
<string>If this option is checked, the default Project, Site, Building and Storeys objects that are usually found in an IFC file are not imported, and all objects are placed in a Group. Buildins ans storeys are still imported if there is more than one.</string>
</property>
<property name="text">
<string>Replace Project, Site, Buiding and Storey by Group</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ifcReplaceProject</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
43 changes: 34 additions & 9 deletions src/Mod/Arch/importIFC.py
Expand Up @@ -161,7 +161,8 @@ def getPreferences():
'IMPORT_PROPERTIES': p.GetBool("ifcImportProperties",False),
'SPLIT_LAYERS': p.GetBool("ifcSplitLayers",False),
'FITVIEW_ONIMPORT': p.GetBool("ifcFitViewOnImport",False),
'ALLOW_INVALID': p.GetBool("ifcAllowInvalid",False)
'ALLOW_INVALID': p.GetBool("ifcAllowInvalid",False),
'REPLACE_PROJECT': p.GetBool("ifcReplaceProject",False)
}

if preferences['MERGE_MODE_ARCH'] > 0:
Expand Down Expand Up @@ -299,23 +300,24 @@ def insert(filename,docname,skip=[],only=[],root=None,preferences=None):
FreeCADGui.ActiveDocument.activeView().viewAxonometric()

# Create the base project object
if len(ifcfile.by_type("IfcProject")) > 0:
projectImporter = importIFCHelper.ProjectImporter(ifcfile, objects)
projectImporter.execute()
else:
# https://forum.freecadweb.org/viewtopic.php?f=39&t=40624
print("No IfcProject found in the ifc file. Nothing imported")
return doc
if not preferences['REPLACE_PROJECT']:
if len(ifcfile.by_type("IfcProject")) > 0:
projectImporter = importIFCHelper.ProjectImporter(ifcfile, objects)
projectImporter.execute()
else:
# https://forum.freecadweb.org/viewtopic.php?f=39&t=40624
print("No IfcProject found in the ifc file. Nothing imported")
return doc

# handle IFC products

for product in products:

count += 1

pid = product.id()
guid = product.GlobalId
ptype = product.is_a()

if preferences['DEBUG']: print(count,"/",len(products),"object #"+str(pid),":",ptype,end="")

# build list of related property sets
Expand Down Expand Up @@ -382,6 +384,20 @@ def insert(filename,docname,skip=[],only=[],root=None,preferences=None):
if ptype in preferences['SKIP']: # preferences-set type skip list
if preferences['DEBUG']: print(" skipped.")
continue
if preferences['REPLACE_PROJECT']: # options-enabled project/site/building skip
if ptype in ['IfcProject','IfcSite']:
if preferences['DEBUG']: print(" skipped.")
continue
elif ptype in ['IfcBuilding']:
if len(ifcfile.by_type("IfcBuilding")) == 1:
# let multiple buildings through...
if preferences['DEBUG']: print(" skipped.")
continue
elif ptype in ['IfcBuildingStorey']:
if len(ifcfile.by_type("IfcBuildingStorey")) == 1:
# let multiple storeys through...
if preferences['DEBUG']: print(" skipped.")
continue

# check if this object is sharing its shape (mapped representation)
clone = None
Expand Down Expand Up @@ -1220,6 +1236,15 @@ def insert(filename,docname,skip=[],only=[],root=None,preferences=None):
if l:
setattr(p[0],p[1],l)

# Grouping everything if required
if preferences['REPLACE_PROJECT']:
rootgroup = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup","Group")
rootgroup.Label = os.path.basename(filename)
for key,obj in objects.items():
# only add top-level objects
if not obj.InList:
rootgroup.addObject(obj)

FreeCAD.ActiveDocument.recompute()

if ZOOMOUT and FreeCAD.GuiUp:
Expand Down
19 changes: 14 additions & 5 deletions src/Mod/Arch/importOBJ.py
Expand Up @@ -72,14 +72,23 @@ def getIndices(obj,shape,offsetv,offsetvn):
try:
if not isinstance(e.Curve,Part.LineSegment):
if not curves:
myshape = obj.Shape.copy(False)
myshape.Placement=obj.getGlobalPlacement()
if obj.isDerivedFrom("App::Link"):
myshape = obj.LinkedObject.Shape.copy(False)
myshape.Placement=obj.LinkPlacement
else:
myshape = obj.Shape.copy(False)
myshape.Placement=obj.getGlobalPlacement()
mesh=MeshPart.meshFromShape(Shape=myshape, LinearDeflection=0.1, AngularDeflection=0.7, Relative=True)
FreeCAD.Console.PrintWarning(translate("Arch","Found a shape containing curves, triangulating")+"\n")
break
except: # unimplemented curve type
myshape = obj.Shape.copy(False)
myshape.Placement=obj.getGlobalPlacement()
if obj.isDerivedFrom("App::Link"):
if obj.Shape:
myshape = obj.Shape.copy(False)
myshape.Placement=obj.LinkPlacement
else:
myshape = obj.Shape.copy(False)
myshape.Placement=obj.getGlobalPlacement()
mesh=MeshPart.meshFromShape(Shape=myshape, LinearDeflection=0.1, AngularDeflection=0.7, Relative=True)
FreeCAD.Console.PrintWarning(translate("Arch","Found a shape containing curves, triangulating")+"\n")
break
Expand Down Expand Up @@ -157,7 +166,7 @@ def export(exportList,filename,colors=None):
materials = []
outfile.write("mtllib " + os.path.basename(filenamemtl) + "\n")
for obj in objectslist:
if obj.isDerivedFrom("Part::Feature") or obj.isDerivedFrom("Mesh::Feature"):
if obj.isDerivedFrom("Part::Feature") or obj.isDerivedFrom("Mesh::Feature") or obj.isDerivedFrom("App::Link"):
hires = None
if FreeCAD.GuiUp:
visible = obj.ViewObject.isVisible()
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Draft/CMakeLists.txt
Expand Up @@ -86,6 +86,8 @@ SET(Draft_view_providers
SET(Draft_GUI_tools
draftguitools/__init__.py
draftguitools/gui_base.py
draftguitools/gui_base_original.py
draftguitools/gui_tool_utils.py
draftguitools/gui_circulararray.py
draftguitools/gui_orthoarray.py
draftguitools/gui_polararray.py
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Draft/Draft.py
Expand Up @@ -514,7 +514,7 @@ def makeCopy(obj,force=None,reparent=False):
_Point(newobj)
if gui:
_ViewProviderPoint(newobj.ViewObject)
elif (getType(obj) == "Dimension") or (force == "Dimension"):
elif (getType(obj) in ["Dimension","LinearDimension"]) or (force == "Dimension"):
newobj = FreeCAD.ActiveDocument.addObject(obj.TypeId,getRealName(obj.Name))
_Dimension(newobj)
if gui:
Expand Down Expand Up @@ -1025,7 +1025,7 @@ def move(objectslist,vector,copy=False):
else:
newobj = obj
newobj.Placement.Base = obj.Placement.Base.add(real_vector)
elif getType(obj) == "Dimension":
elif getType(obj) in ["Dimension","LinearDimension"]:
if copy:
newobj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",getRealName(obj.Name))
_Dimension(newobj)
Expand Down Expand Up @@ -1589,7 +1589,7 @@ def getProj(vec):
ny = DraftVecUtils.project(vec,plane.v)
return Vector(nx.Length,ny.Length,0)

if getType(obj) == "Dimension":
if getType(obj) in ["Dimension","LinearDimension"]:
p1 = getProj(obj.Start)
p2 = getProj(obj.End)
p3 = getProj(obj.Dimline)
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/Draft/DraftGui.py
Expand Up @@ -1893,8 +1893,7 @@ def getXPM(self,iconname,size=16):
return str(a)

def togglesnap(self):
if hasattr(FreeCADGui,"Snapper"):
FreeCADGui.Snapper.toggle()
FreeCADGui.doCommand('FreeCADGui.runCommand("Draft_Snap_Lock")')

def togglenearsnap(self):
if hasattr(FreeCADGui,"Snapper"):
Expand Down

0 comments on commit 12fd4de

Please sign in to comment.