Skip to content

Commit

Permalink
Merge pull request #129 from easyw/master
Browse files Browse the repository at this point in the history
added forceFixedPosition option on importing A2p parts
  • Loading branch information
kbwbe authored Dec 20, 2018
2 parents 78695b5 + 098b8b0 commit 446b9bb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions GuiA2p/Resources/ui/a2p_prefs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_3">
<property name="text">
<string>force FixedPosition to all Imports</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>forceFixedPosition</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/A2plus</cstring>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
Expand Down
5 changes: 4 additions & 1 deletion a2p_importpart.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ def importPartFromFile(_doc, filename, importToCache=False):
newObj.setEditorMode("timeLastImport",1)
newObj.timeLastImport = os.path.getmtime( filename )
newObj.addProperty("App::PropertyBool","fixedPosition","importPart")
newObj.fixedPosition = not any([i.fixedPosition for i in doc.Objects if hasattr(i, 'fixedPosition') ])
if a2plib.getForceFixedPosition():
newObj.fixedPosition = True
else:
newObj.fixedPosition = not any([i.fixedPosition for i in doc.Objects if hasattr(i, 'fixedPosition') ])
newObj.addProperty("App::PropertyBool","subassemblyImport","importPart").subassemblyImport = subAssemblyImport
newObj.setEditorMode("subassemblyImport",1)
newObj.addProperty("App::PropertyBool","updateColors","importPart").updateColors = True
Expand Down
5 changes: 5 additions & 0 deletions a2plib.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
PARTIAL_PROCESSING_ENABLED = preferences.GetBool('usePartialSolver', True)
AUTOSOLVE_ENABLED = preferences.GetBool('autoSolve', True)
RELATIVE_PATHES_ENABLED = preferences.GetBool('useRelativePathes',True)
FORCE_FIXED_POSITION = preferences.GetBool('forceFixedPosition',True)

SAVED_TRANSPARENCY = []

Expand Down Expand Up @@ -64,6 +65,10 @@

PARTIAL_SOLVE_STAGE1 = 1 #solve all rigid fully constrained to tempfixed rigid, enable only involved dep, then set them as tempfixed

#------------------------------------------------------------------------------
def getForceFixedPosition():
preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/A2plus")
return preferences.GetBool('forceFixedPosition',False)
#------------------------------------------------------------------------------
def getUseTopoNaming():
preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/A2plus")
Expand Down

0 comments on commit 446b9bb

Please sign in to comment.