Skip to content

Commit

Permalink
Merge pull request #159 from kbwbe/devel
Browse files Browse the repository at this point in the history
new preferences option: doNotImportInvisibleShapes
  • Loading branch information
kbwbe authored Jan 20, 2019
2 parents 446989b + 0d8672e commit cc961f8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
19 changes: 16 additions & 3 deletions GuiA2p/Resources/ui/a2p_prefs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>675</width>
<height>800</height>
<height>850</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -73,7 +73,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
<height>230</height>
</size>
</property>
<property name="title">
Expand All @@ -85,7 +85,7 @@
<x>20</x>
<y>30</y>
<width>621</width>
<height>141</height>
<height>181</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
Expand Down Expand Up @@ -141,6 +141,19 @@
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_8">
<property name="text">
<string>do not import invisible shapes (use with caution, can break assemblies)</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>doNotImportInvisibleShapes</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/A2plus</cstring>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
Expand Down
13 changes: 13 additions & 0 deletions a2p_topomapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,23 @@ def getTopLevelObjects(self):
self.topLevelShapes.extend(addList)
#-------------------------------------------
# Got some shapes created by PathWB? filter out...
# also filter out invisible shapes...
#-------------------------------------------
tmp = []
for n in self.topLevelShapes:
if self.addedByPathWB(n): continue
#
if a2plib.doNotImportInvisibleShapes():
ob = self.doc.getObject(n)
if hasattr(ob,"ViewObject"):
if hasattr(ob.ViewObject,"Visibility"):
if ob.ViewObject.Visibility == False:
print(
"Import ignored invisible shape! {}".format(
ob.Name
)
)
continue
tmp.append(n)
self.topLevelShapes = tmp
#-------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions a2plib.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def to_str(tx):
value = tx.decode("utf-8")
return value # Instance of unicode string
#------------------------------------------------------------------------------
def doNotImportInvisibleShapes():
preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/A2plus")
return preferences.GetBool('doNotImportInvisibleShapes',True)
#------------------------------------------------------------------------------
def getPerFaceTransparency():
preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/A2plus")
return preferences.GetBool('usePerFaceTransparency',False)
Expand Down

0 comments on commit cc961f8

Please sign in to comment.