Skip to content

Commit

Permalink
code cleanings
Browse files Browse the repository at this point in the history
  • Loading branch information
kbwbe committed May 12, 2019
1 parent 196e905 commit fade1a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion a2p_importedPart_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from FreeCAD import Base
from PySide import QtGui
import a2plib

from a2p_versionmanagement import A2P_VERSION
#==============================================================================
class Proxy_importPart:
'''
Expand All @@ -46,6 +46,7 @@ def setProperties(self,obj):
propList = obj.PropertiesList
if not "a2p_Version" in propList:
obj.addProperty("App::PropertyString", "a2p_Version", "importPart")
obj.a2p_Version = A2P_VERSION
if not "sourceFile" in propList:
obj.addProperty("App::PropertyFile", "sourceFile", "importPart")
if not "sourcePart" in propList:
Expand All @@ -58,6 +59,7 @@ def setProperties(self,obj):
obj.addProperty("App::PropertyBool","fixedPosition","importPart")
if not "subassemblyImport" in propList:
obj.addProperty("App::PropertyBool","subassemblyImport","importPart")
obj.subassemblyImport = False
if not "updateColors" in propList:
obj.addProperty("App::PropertyBool","updateColors","importPart")
obj.updateColors = True
Expand Down
13 changes: 9 additions & 4 deletions a2p_importpart.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
)

import a2p_lcs_support
from a2p_importedPart_class import Proxy_importPart
from a2p_importedPart_class import Proxy_importPart, ImportedPartViewProviderProxy

PYVERSION = sys.version_info[0]

Expand Down Expand Up @@ -580,9 +580,14 @@ def updateImportedParts(doc):
for obj in doc.Objects:
if hasattr(obj, 'sourceFile') and a2plib.to_str(obj.sourceFile) != a2plib.to_str('converted'):

if not "sourcePart" in obj.PropertiesList:
obj.addProperty("App::PropertyString", "sourcePart", "importPart")


#repair data structures (perhaps an old Assembly2 import was found)
if hasattr(obj,"Content") and 'importPart' in obj.Content: # be sure to have an assembly object
if obj.Proxy is None:
#print (u"Repair Proxy of: {}, Proxy: {}".format(obj.Label, obj.Proxy))
Proxy_importPart(obj)
ImportedPartViewProviderProxy(obj.ViewObject)

assemblyPath = os.path.normpath(os.path.split(doc.FileName)[0])
absPath = a2plib.findSourceFileInProject(obj.sourceFile, assemblyPath)

Expand Down

0 comments on commit fade1a2

Please sign in to comment.