Path: Added pref setting to disable auto-include of new paths in projects
This commit is contained in:
parent
a691fec1dd
commit
cbdd18cef6
|
@ -31,72 +31,16 @@
|
|||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="pathTestSetting1">
|
||||
<property name="toolTip">
|
||||
<string>If this is checked, object names will be prefixed with the IFC ID number</string>
|
||||
<string>If this option is enabled, new paths will automatically be placed in the active project, which will be created if necessary.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Test setting 1</string>
|
||||
<string>Automatic project handling</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>pathTestSetting1</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Test setting 2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefLineEdit" name="pathTestSetting2">
|
||||
<property name="toolTip">
|
||||
<string>A comma-separated list of Ifc entities to exclude from import</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>pathTestSetting2</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Test group</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="pathTestSetting3">
|
||||
<property name="toolTip">
|
||||
<string>Some IFC viewers don't like objects exported as extrusions. Use this to force all objects to be exported as BREP geometry.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Test setting 3</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>pathTestSetting3</cstring>
|
||||
<cstring>pathAutoProject</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Path</cstring>
|
||||
|
@ -131,11 +75,6 @@
|
|||
<extends>QCheckBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -123,11 +123,13 @@ class CommandPathArray:
|
|||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Array")
|
||||
FreeCADGui.addModule("PathScripts.PathArray")
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Array")')
|
||||
FreeCADGui.doCommand('PathScripts.PathArray.ObjectArray(obj)')
|
||||
FreeCADGui.doCommand('obj.Base = (FreeCAD.ActiveDocument.' + selection[0].Name + ')')
|
||||
#FreeCADGui.doCommand('PathScripts.PathArray.ViewProviderArray(obj.ViewObject)')
|
||||
FreeCADGui.doCommand('obj.ViewObject.Proxy = 0')
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToProject(obj)')
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
|
|
@ -74,9 +74,11 @@ class CommandPathCustom:
|
|||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Custom Path")
|
||||
FreeCADGui.addModule("PathScripts.PathCustom")
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Custom")')
|
||||
FreeCADGui.doCommand('PathScripts.PathCustom.ObjectCustom(obj)')
|
||||
FreeCADGui.doCommand('obj.ViewObject.Proxy = 0')
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToProject(obj)')
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
|
|
@ -171,6 +171,7 @@ class CommandPathFacePocket:
|
|||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Pocket")
|
||||
FreeCADGui.addModule("PathScripts.PathFacePocket")
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","FacePocket")')
|
||||
FreeCADGui.doCommand('PathScripts.PathFacePocket.ObjectFacePocket(obj)')
|
||||
subs = "["
|
||||
|
@ -179,6 +180,7 @@ class CommandPathFacePocket:
|
|||
subs += "]"
|
||||
FreeCADGui.doCommand('obj.Base = (FreeCAD.ActiveDocument.' + selection[0].ObjectName + ',' + subs + ')')
|
||||
FreeCADGui.doCommand('obj.ViewObject.Proxy = 0')
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToProject(obj)')
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
|
|
@ -134,10 +134,12 @@ class CommandPathFaceProfile:
|
|||
# if everything is ok, execute and register the transaction in the undo/redo stack
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Profile")
|
||||
FreeCADGui.addModule("PathScripts.PathFaceProfile")
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","FaceProfile")')
|
||||
FreeCADGui.doCommand('PathScripts.PathFaceProfile.ObjectFaceProfile(obj)')
|
||||
FreeCADGui.doCommand('obj.Base = (FreeCAD.ActiveDocument.'+selection[0].ObjectName+',"'+selection[0].SubElementNames[0]+'")')
|
||||
FreeCADGui.doCommand('obj.ViewObject.Proxy = 0')
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToProject(obj)')
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
|
|
@ -95,8 +95,10 @@ class CommandFromShape:
|
|||
return
|
||||
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_FromShape","Create path from shape"))
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand("obj = FreeCAD.activeDocument().addObject('Path::FeatureShape','PathShape')")
|
||||
FreeCADGui.doCommand("obj.Shape = FreeCAD.activeDocument()."+selection[0].Name+".Shape")
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToProject(obj)')
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ class CommandPathHop:
|
|||
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("PathHop","Create Hop"))
|
||||
FreeCADGui.addModule("PathScripts.PathHop")
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")')
|
||||
FreeCADGui.doCommand('PathScripts.PathHop.ObjectHop(obj)')
|
||||
FreeCADGui.doCommand('PathScripts.PathHop.ViewProviderPathHop(obj.ViewObject)')
|
||||
|
|
|
@ -60,8 +60,10 @@ class CommandPathSimpleCopy:
|
|||
return
|
||||
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Path_SimpleCopy","Simple Copy"))
|
||||
FreeCADGui.doCommand('copy = FreeCAD.ActiveDocument.addObject("Path::Feature","'+selection[0].Name+ '_copy")')
|
||||
FreeCADGui.doCommand('copy.Path = FreeCAD.ActiveDocument.'+selection[0].Name+'.Path')
|
||||
FreeCADGui.addModule("PathScripts.PathUtils")
|
||||
FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::Feature","'+selection[0].Name+ '_copy")')
|
||||
FreeCADGui.doCommand('obj.Path = FreeCAD.ActiveDocument.'+selection[0].Name+'.Path')
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToProject(obj)')
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
|
|
@ -360,16 +360,16 @@ def findMachine():
|
|||
|
||||
def addToProject(obj):
|
||||
"""Adds a path obj to this document, if no PathParoject exists it's created on the fly"""
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path")
|
||||
if p.GetBool("pathAutoProject",True):
|
||||
project = findProj()
|
||||
|
||||
if project == None:
|
||||
if not project:
|
||||
project = PathProject.CommandProject.Create()
|
||||
|
||||
g = project.Group
|
||||
g.append(obj)
|
||||
project.Group = g
|
||||
|
||||
return project
|
||||
return None
|
||||
|
||||
|
||||
def getLastZ(obj):
|
||||
|
|
Loading…
Reference in New Issue
Block a user