Skip to content

Commit

Permalink
Merge pull request #239 from kbwbe/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
kbwbe authored Feb 26, 2019
2 parents 2d3e372 + a51fa68 commit e521e28
Show file tree
Hide file tree
Showing 15 changed files with 363 additions and 873 deletions.
124 changes: 61 additions & 63 deletions GuiA2p/Resources/icons/a2p_PartsInfo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 56 additions & 68 deletions GuiA2p/Resources/icons/a2p_PartsList.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions GuiA2p/Resources/ui/a2p_prefs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<property name="geometry">
<rect>
<x>10</x>
<y>390</y>
<y>480</y>
<width>621</width>
<height>51</height>
<height>61</height>
</rect>
</property>
<property name="title">
Expand All @@ -29,8 +29,8 @@
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>221</width>
<y>30</y>
<width>311</width>
<height>17</height>
</rect>
</property>
Expand All @@ -54,10 +54,10 @@
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<x>0</x>
<y>240</y>
<width>621</width>
<height>191</height>
<height>231</height>
</rect>
</property>
<property name="toolTip">
Expand Down Expand Up @@ -188,7 +188,7 @@ subassemblies. Otherwise you can break the assembly.</string>
<property name="geometry">
<rect>
<x>10</x>
<y>440</y>
<y>580</y>
<width>441</width>
<height>161</height>
</rect>
Expand Down Expand Up @@ -295,10 +295,10 @@ subassemblies. Otherwise you can break the assembly.</string>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<x>0</x>
<y>160</y>
<width>621</width>
<height>51</height>
<height>61</height>
</rect>
</property>
<property name="title">
Expand All @@ -308,7 +308,7 @@ subassemblies. Otherwise you can break the assembly.</string>
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<y>30</y>
<width>283</width>
<height>17</height>
</rect>
Expand All @@ -333,7 +333,7 @@ subassemblies. Otherwise you can break the assembly.</string>
<x>10</x>
<y>10</y>
<width>621</width>
<height>101</height>
<height>131</height>
</rect>
</property>
<property name="title">
Expand Down
2 changes: 1 addition & 1 deletion InitGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
__title__ = 'A2plus assembly Workbench - InitGui file'
__author__ = 'kbwbe'

A2P_VERSION = 'V0.3.16'
A2P_VERSION = 'V0.4.0'

import sys
PyVersion = sys.version_info[0]
Expand Down
90 changes: 16 additions & 74 deletions a2p_MuxAssembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def makePlacedShape(obj):
tempShape.Placement = plmGlobal
return tempShape

def muxAssemblyWithTopoNames(doc, withColor=False):
def muxAssemblyWithTopoNames(doc):
'''
Mux an a2p assenbly
Expand Down Expand Up @@ -116,7 +116,7 @@ def muxAssemblyWithTopoNames(doc, withColor=False):
muxInfo.append(newName)

# Save Computing time, store this before the for..enumerate loop later...
colorFlag = ( len(obj.ViewObject.DiffuseColor) < len(obj.Shape.Faces) )
needDiffuseColorExtension = ( len(obj.ViewObject.DiffuseColor) < len(obj.Shape.Faces) )
shapeCol = obj.ViewObject.ShapeColor
diffuseCol = obj.ViewObject.DiffuseColor
tempShape = makePlacedShape(obj)
Expand All @@ -125,24 +125,22 @@ def muxAssemblyWithTopoNames(doc, withColor=False):

# now start the loop with use of the stored values..(much faster)
topoNaming = a2plib.getUseTopoNaming()
for i, face in enumerate(tempShape.Faces):
faces.append(face)
diffuseElement = makeDiffuseElement(shapeCol,transparency)
for i in range(0,len(tempShape.Faces)):
if topoNaming:
if extendNames:
newName = "".join((faceNames[i],obj.Name,';'))
muxInfo.append(newName)
else:
newName = "".join(('F;',str(i+1),';',obj.Name,';'))
muxInfo.append(newName)
if needDiffuseColorExtension:
faceColors.append(diffuseElement)

if not needDiffuseColorExtension:
faceColors.extend(diffuseCol)

if withColor:
if colorFlag:
if not a2plib.getPerFaceTransparency():
faceColors.append(shapeCol)
else:
faceColors.append(makeDiffuseElement(shapeCol,transparency))
else:
faceColors.append(diffuseCol[i])
faces.extend(tempShape.Faces)

shell = Part.makeShell(faces)
try:
Expand All @@ -160,69 +158,13 @@ def muxAssemblyWithTopoNames(doc, withColor=False):
except:
# keeping a shell if solid is failing
solid = shell
if withColor:
return muxInfo, solid, faceColors, transparency
else:
return muxInfo, solid

def muxObjectsWithKeys(objsIn, withColor=False):
'''
combines all the objects in objsIn into one shape,
is able to import colors
'''
faces = []
faceColors = []
muxInfo = [] # List of keys, not used at moment...
shape_list = []

for obj in objsIn:
# Save Computing time, store this before the for..enumerate loop later...
colorFlag = ( len(obj.ViewObject.DiffuseColor) < len(obj.Shape.Faces) )
shapeCol = obj.ViewObject.ShapeColor
diffuseCol = obj.ViewObject.DiffuseColor
tempShape = makePlacedShape(obj)
transparency = obj.ViewObject.Transparency
shape_list.append(obj.Shape)

# now start the loop with use of the stored values..(much faster)
for i, face in enumerate(tempShape.Faces):
faces.append(face)
DebugMsg(A2P_DEBUG_3,"a2p MUX: i(Faces)={}\n{}\n".format(i,face))

if withColor:
if colorFlag:
if not a2plib.getPerFaceTransparency():
faceColors.append(shapeCol)
else:
faceColors.append(makeDiffuseElement(shapeCol,transparency))
else:
faceColors.append(diffuseCol[i])

shell = Part.makeShell(faces)
try:
solid = Part.Solid(shell)
except:
# keeping a shell if solid is failing
solid = shell
if withColor:
return muxInfo, solid, faceColors, transparency
else:
return muxInfo, solid

#NOTE: muxObjects is never called in A2plus
def muxObjects(doc, mode=0):
'combines all the imported shape object in doc into one shape'
faces = []
if mode == 1:
objects = doc.getSelection()
else:
objects = doc.Objects

for obj in objects:
if 'importPart' in obj.Content:
faces = faces + obj.Shape.Faces
shell = Part.makeShell(faces)
return shell
# transparency coud change to different values depending
# of order of imported objects
# now set it to a default value
# faceColors still contains the per face transparency values
transparency = 0
return muxInfo, solid, faceColors, transparency

class SimpleAssemblyShape:
def __init__(self, obj):
Expand Down
8 changes: 4 additions & 4 deletions a2p_Resources2.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions a2p_Resources3.py

Large diffs are not rendered by default.

Loading

0 comments on commit e521e28

Please sign in to comment.