def setColorsWithAmendmentAndReturnTrueIfNoOverrides(self, drawingTdo): result = false amendmentToUse = PdPlantDrawingAmendment() color = TColorRef() backfaceColor = TColorRef() lineColor = TColorRef() iHaveAnAmendment = false iDontHaveAnAmendment = false myParentHasAnAmendment = false myAmendmentSaysIAmHidden = false myParentsAmendmentSaysIAmHidden = false iAmSelectedInTheMainWindow = false showHighlights = false result = true if not udomain.domain.options.showPosingAtAll: return result if self.plant.turtle == None: return result color = 0 backfaceColor = 0 lineColor = 0 iHaveAnAmendment = self.amendment != None iDontHaveAnAmendment = self.amendment == None myParentHasAnAmendment = self.parentAmendment != None myAmendmentSaysIAmHidden = (self.amendment != None) and (self.amendment.hide) myParentsAmendmentSaysIAmHidden = (self.parentAmendment != None) and ( self.parentAmendment.hide) iAmSelectedInTheMainWindow = ( self.partID == umain.MainForm.selectedPlantPartID) and ( umain.MainForm.focusedPlant() == self.plant) showHighlights = udomain.domain.options.showHighlightingForNonHiddenPosedParts and ( self.plant.turtle.writingTo == u3dexport.kScreen) and ( not udomain.domain.drawingToMakeCopyBitmap) and ( not self.plant.drawingIntoPreviewCache) if iHaveAnAmendment or myParentHasAnAmendment: result = false if (iHaveAnAmendment and iAmSelectedInTheMainWindow and showHighlights): color = udomain.domain.options.selectedPosedColor elif (iHaveAnAmendment and myAmendmentSaysIAmHidden) or ( iDontHaveAnAmendment and myParentHasAnAmendment and myParentsAmendmentSaysIAmHidden): color = udomain.domain.options.ghostingColor elif (iHaveAnAmendment and showHighlights): color = udomain.domain.options.nonHiddenPosedColor else: result = true if result == false: if backfaceColor == 0: backfaceColor = color if lineColor == 0: lineColor = color if drawingTdo: self.plant.turtle.setForeColorBackColor(color, backfaceColor) self.plant.turtle.setLineColor(usupport.darkerColor(color)) else: self.plant.turtle.setLineColor(lineColor) return result
def draw3DObject(self, tdo, scale, faceColor, backfaceColor, dxfIndex): if tdo == None: return turtle = self.plant.turtle if (turtle == None): return if self.setColorsWithAmendmentAndReturnTrueIfNoOverrides(kDrawingTdo): turtle.setForeColorBackColor(faceColor, backfaceColor) turtle.setLineColor(usupport.darkerColor(faceColor)) realScale = scale * self.scaleMultiplierConsideringAmendments() turtle.setLineWidth(1.0) tdo.draw(turtle, realScale, self.longNameForDXFPartConsideringGenderEtc(dxfIndex), self.shortNameForDXFPartConsideringGenderEtc(dxfIndex), self.realDxfIndexForBaseDXFPart(dxfIndex), self.partID)
def setColorsWithAmendmentAndReturnTrueIfNoOverrides(self, drawingTdo): result = false amendmentToUse = PdPlantDrawingAmendment() color = TColorRef() backfaceColor = TColorRef() lineColor = TColorRef() iHaveAnAmendment = false iDontHaveAnAmendment = false myParentHasAnAmendment = false myAmendmentSaysIAmHidden = false myParentsAmendmentSaysIAmHidden = false iAmSelectedInTheMainWindow = false showHighlights = false result = true if not udomain.domain.options.showPosingAtAll: return result if self.plant.turtle == None: return result color = 0 backfaceColor = 0 lineColor = 0 iHaveAnAmendment = self.amendment != None iDontHaveAnAmendment = self.amendment == None myParentHasAnAmendment = self.parentAmendment != None myAmendmentSaysIAmHidden = (self.amendment != None) and (self.amendment.hide) myParentsAmendmentSaysIAmHidden = (self.parentAmendment != None) and (self.parentAmendment.hide) iAmSelectedInTheMainWindow = (self.partID == umain.MainForm.selectedPlantPartID) and (umain.MainForm.focusedPlant() == self.plant) showHighlights = udomain.domain.options.showHighlightingForNonHiddenPosedParts and (self.plant.turtle.writingTo == u3dexport.kScreen) and (not udomain.domain.drawingToMakeCopyBitmap) and (not self.plant.drawingIntoPreviewCache) if iHaveAnAmendment or myParentHasAnAmendment: result = false if (iHaveAnAmendment and iAmSelectedInTheMainWindow and showHighlights): color = udomain.domain.options.selectedPosedColor elif (iHaveAnAmendment and myAmendmentSaysIAmHidden) or (iDontHaveAnAmendment and myParentHasAnAmendment and myParentsAmendmentSaysIAmHidden): color = udomain.domain.options.ghostingColor elif (iHaveAnAmendment and showHighlights): color = udomain.domain.options.nonHiddenPosedColor else: result = true if result == false: if backfaceColor == 0: backfaceColor = color if lineColor == 0: lineColor = color if drawingTdo: self.plant.turtle.setForeColorBackColor(color, backfaceColor) self.plant.turtle.setLineColor(usupport.darkerColor(color)) else: self.plant.turtle.setLineColor(lineColor) return result