def accept(self): doc = FreeCADGui.getDocument(self.obj.Document) doc.resetEdit() # Macro script FreeCADGui.doCommand("\nobj = FreeCAD.ActiveDocument.{}".format( self.obj.Name)) FreeCADGui.doCommand("obj.RefinementInterval = {}".format( int(self.form.sb_refinement_interval.value()))) FreeCADGui.doCommand("obj.MaxRefinementLevel = {}".format( int(self.form.sb_max_refinement_levels.value()))) FreeCADGui.doCommand("obj.BufferLayers = {}".format( int(self.form.sb_no_buffer_layers.value()))) FreeCADGui.doCommand("obj.MaxRefinementCells = {}".format( int(ceil(float(getQuantity(self.form.if_max_cells)))))) FreeCADGui.doCommand("obj.RefinementField = '{}'".format( self.form.le_refinement_field.text())) FreeCADGui.doCommand("obj.LowerRefinementLevel = {}".format( getQuantity(self.form.if_lower_refinement))) FreeCADGui.doCommand("obj.UpperRefinementLevel = {}".format( getQuantity(self.form.if_upper_refinement))) FreeCADGui.doCommand("obj.UnRefinementLevel = {}".format( int(float(getQuantity(self.form.if_unrefine_level))))) FreeCADGui.doCommand("obj.WriteFields = {}".format( self.form.cb_write_refinement_volscalarfield.isChecked())) # Finalise FreeCADGui.doCommand("FreeCAD.ActiveDocument.recompute()")
def store(self): mesher_idx = self.form.cb_utility.currentIndex() storeIfChanged(self.mesh_obj, 'CharacteristicLengthMax', getQuantity(self.form.if_max)) storeIfChanged(self.mesh_obj, 'MeshUtility', CfdMesh.MESHERS[mesher_idx]) storeIfChanged(self.mesh_obj, 'ElementDimension', CfdMesh.DIMENSION[mesher_idx]) storeIfChanged(self.mesh_obj, 'CellsBetweenLevels', self.form.if_cellsbetweenlevels.value()) storeIfChanged(self.mesh_obj, 'EdgeRefinement', self.form.if_edgerefine.value()) storeIfChanged(self.mesh_obj, 'ConvertToDualMesh', CfdMesh.DUAL_CONVERSION[mesher_idx]) storeIfChanged(self.mesh_obj, 'ImplicitEdgeDetection', self.form.radio_implicit_edge_detection.isChecked()) point_in_mesh = { 'x': getQuantity(self.form.if_pointInMeshX), 'y': getQuantity(self.form.if_pointInMeshY), 'z': getQuantity(self.form.if_pointInMeshZ) } if self.mesh_obj.MeshUtility == 'snappyHexMesh': storeIfChanged(self.mesh_obj, 'PointInMesh', point_in_mesh) self.mesh_obj.Proxy.cart_mesh = CfdMeshTools.CfdMeshTools( self.mesh_obj)
def accept(self): doc = FreeCADGui.getDocument(self.obj.Document) doc.resetEdit() # Type storeIfChanged(self.obj, 'FieldName', self.form.inputScalarFieldName.text()) storeIfChanged(self.obj, 'DiffusivityFixed', self.form.radioUniformDiffusivity.isChecked()) storeIfChanged(self.obj, 'DiffusivityFixedValue', getQuantity(self.form.inputDiffusivity)) storeIfChanged(self.obj, 'RestrictToPhase', self.form.checkRestrictToPhase.isChecked()) storeIfChanged(self.obj, 'PhaseName', self.form.comboPhase.currentText()) injection_point = FreeCAD.Vector( self.form.inputInjectionPointx.property("quantity").Value, self.form.inputInjectionPointy.property("quantity").Value, self.form.inputInjectionPointz.property("quantity").Value) storeIfChanged(self.obj, 'InjectionPoint', injection_point) storeIfChanged(self.obj, 'InjectionRate', getQuantity(self.form.inputInjectionRate)) # Finalise FreeCADGui.doCommand("FreeCAD.ActiveDocument.recompute()")
def accept(self): doc = FreeCADGui.getDocument(self.obj.Document) doc.resetEdit() if self.form.radioButtonSteady.isChecked(): storeIfChanged(self.obj, 'Time', 'Steady') elif self.form.radioButtonTransient.isChecked(): storeIfChanged(self.obj, 'Time', 'Transient') if self.form.radioButtonSinglePhase.isChecked(): storeIfChanged(self.obj, 'Phase', 'Single') elif self.form.radioButtonFreeSurface.isChecked(): storeIfChanged(self.obj, 'Phase', 'FreeSurface') if self.form.radioButtonIncompressible.isChecked(): storeIfChanged(self.obj, 'Flow', 'Incompressible') storeIfChanged(self.obj, 'Thermal', 'None') elif self.form.radioButtonCompressible.isChecked(): if self.form.checkBoxHighMach.isChecked(): storeIfChanged(self.obj, 'Flow', 'HighMachCompressible') else: storeIfChanged(self.obj, 'Flow', 'Compressible') storeIfChanged(self.obj, 'Thermal', 'Energy') if self.form.viscousCheckBox.isChecked(): if self.form.radioButtonLaminar.isChecked(): storeIfChanged(self.obj, 'Turbulence', 'Laminar') else: if self.form.radioButtonRANS.isChecked(): storeIfChanged(self.obj, 'Turbulence', 'RANS') elif self.form.radioButtonDES.isChecked(): storeIfChanged(self.obj, 'Turbulence', 'DES') elif self.form.radioButtonLES.isChecked(): storeIfChanged(self.obj, 'Turbulence', 'LES') storeIfChanged(self.obj, 'TurbulenceModel', self.form.turbulenceComboBox.currentText()) else: storeIfChanged(self.obj, 'Turbulence', 'Inviscid') storeIfChanged(self.obj, 'gx', getQuantity(self.form.gx)) storeIfChanged(self.obj, 'gy', getQuantity(self.form.gy)) storeIfChanged(self.obj, 'gz', getQuantity(self.form.gz))
def manualEdit(self): if not self.selecting_predefined: self.form.PredefinedMaterialLibraryComboBox.setCurrentIndex( self.form.PredefinedMaterialLibraryComboBox.findText('Custom')) self.form.fluidDescriptor.setText("User-entered properties") curr_type = self.material['Type'] self.material = {'Name': 'Custom', 'Description': 'User-entered properties', 'Type': curr_type} for f in self.fields: if f.endswith('Polynomial'): self.material[f] = self.text_boxes[f].text() else: self.material[f] = getQuantity(self.text_boxes[f]) self.selectPredefined()
def accept(self): FreeCADGui.Selection.removeObserver(self) doc = FreeCADGui.getDocument(self.obj.Document) doc.resetEdit() # Type index = self.form.comboFunctionObjectType.currentIndex() storeIfChanged(self.obj, 'ReportingFunctionType', CfdReportingFunction.OBJECT_NAMES[self.form.comboFunctionObjectType.currentIndex()]) bcs = CfdTools.getCfdBoundaryGroup(self.analysis_obj) bc = bcs[self.form.cb_patch_list.currentIndex()] if (not self.obj.Patch and bc) or (bc and bc.Name != self.obj.Patch.Name): FreeCADGui.doCommand("FreeCAD.ActiveDocument.{}.Patch " "= FreeCAD.ActiveDocument.{}".format(self.obj.Name, bc.Name)) # Force object storeIfChanged(self.obj, 'ReferenceDensity', getQuantity(self.form.inputReferenceDensity)) storeIfChanged(self.obj, 'ReferencePressure', getQuantity(self.form.inputReferencePressure)) storeIfChanged(self.obj, 'WriteFields', self.form.inputWriteFields.isChecked()) centre_of_rotation = FreeCAD.Vector( self.form.inputCentreOfRotationx.property("quantity").Value, self.form.inputCentreOfRotationy.property("quantity").Value, self.form.inputCentreOfRotationz.property("quantity").Value) storeIfChanged(self.obj, 'CentreOfRotation', centre_of_rotation) # # Coefficient object lift_dir = FreeCAD.Vector( self.form.inputLiftDirectionx.property("quantity").Value, self.form.inputLiftDirectiony.property("quantity").Value, self.form.inputLiftDirectionz.property("quantity").Value) storeIfChanged(self.obj, 'Lift', lift_dir) drag_dir = FreeCAD.Vector( self.form.inputDragDirectionx.property("quantity").Value, self.form.inputDragDirectiony.property("quantity").Value, self.form.inputDragDirectionz.property("quantity").Value) storeIfChanged(self.obj, 'Drag', drag_dir) storeIfChanged(self.obj, 'MagnitudeUInf', getQuantity(self.form.inputMagnitudeUInf)) storeIfChanged(self.obj, 'LengthRef', getQuantity(self.form.inputLengthRef)) storeIfChanged(self.obj, 'AreaRef', getQuantity(self.form.inputAreaRef)) # # Spatial binning storeIfChanged(self.obj, 'NBins', self.form.inputNBins.value()) bins_direction = FreeCAD.Vector( self.form.inputDirectionx.property("quantity").Value, self.form.inputDirectiony.property("quantity").Value, self.form.inputDirectionz.property("quantity").Value) storeIfChanged(self.obj, 'Direction', bins_direction) storeIfChanged(self.obj, 'Cumulative', self.form.inputCumulative.isChecked()) # Probe info storeIfChanged(self.obj, 'SampleFieldName', self.form.inputFieldName.text()) probe_position = FreeCAD.Vector( self.form.inputProbeLocx.property("quantity").Value, self.form.inputProbeLocy.property("quantity").Value, self.form.inputProbeLocz.property("quantity").Value) storeIfChanged(self.obj, 'ProbePosition', probe_position) # Finalise FreeCADGui.doCommand("FreeCAD.ActiveDocument.recompute()")
def accept(self): self.analysis_obj.NeedsMeshRewrite = self.NeedsMeshRewriteOrig self.analysis_obj.NeedsCaseRewrite = self.NeedsCaseRewriteOrig if self.obj.Label.startswith("CfdFluidBoundary"): storeIfChanged(self.obj, 'Label', self.obj.BoundaryType) # Type if self.obj.BoundaryType != self.BoundaryTypeOrig: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryType = '{}'".format(self.obj.Name, self.obj.BoundaryType)) if self.obj.BoundarySubType != self.BoundarySubTypeOrig: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundarySubType = '{}'".format(self.obj.Name, self.obj.BoundarySubType)) storeIfChanged(self.obj, 'ThermalBoundaryType', CfdFluidBoundary.THERMAL_BOUNDARY_TYPES[self.form.comboThermalBoundaryType.currentIndex()]) # Velocity storeIfChanged(self.obj, 'VelocityIsCartesian', self.form.radioButtonCart.isChecked()) storeIfChanged(self.obj, 'Ux', getQuantity(self.form.inputCartX)) storeIfChanged(self.obj, 'Uy', getQuantity(self.form.inputCartY)) storeIfChanged(self.obj, 'Uz', getQuantity(self.form.inputCartZ)) storeIfChanged(self.obj, 'VelocityMag', getQuantity(self.form.inputVelocityMag)) storeIfChanged(self.obj, 'DirectionFace', self.form.lineDirection.text()) storeIfChanged(self.obj, 'ReverseNormal', self.form.checkReverse.isChecked()) storeIfChanged(self.obj, 'MassFlowRate', getQuantity(self.form.inputMassFlowRate)) storeIfChanged(self.obj, 'VolFlowRate', getQuantity(self.form.inputVolFlowRate)) # Pressure storeIfChanged(self.obj, 'Pressure', getQuantity(self.form.inputPressure)) # Wall storeIfChanged(self.obj, 'SlipRatio', getQuantity(self.form.inputSlipRatio)) # Thermal storeIfChanged(self.obj, 'Temperature', getQuantity(self.form.inputTemperature)) storeIfChanged(self.obj, 'HeatFlux', getQuantity(self.form.inputHeatFlux)) storeIfChanged(self.obj, 'HeatTransferCoeff', getQuantity(self.form.inputHeatTransferCoeff)) # Turbulence if self.turb_model in CfdFluidBoundary.TURBULENT_INLET_SPEC: turb_index = self.form.comboTurbulenceSpecification.currentIndex() storeIfChanged(self.obj, 'TurbulenceInletSpecification', CfdFluidBoundary.TURBULENT_INLET_SPEC[self.turb_model][1][turb_index]) else: storeIfChanged(self.obj, 'TurbulenceInletSpecification', self.obj.TurbulenceInletSpecification) storeIfChanged(self.obj, 'TurbulentKineticEnergy', getQuantity(self.form.inputKineticEnergy)) storeIfChanged(self.obj, 'SpecificDissipationRate', getQuantity(self.form.inputSpecificDissipationRate)) storeIfChanged(self.obj, 'DissipationRate', getQuantity(self.form.inputDissipationRate)) storeIfChanged(self.obj, 'NuTilda', getQuantity(self.form.inputNuTilda)) storeIfChanged(self.obj, 'Intermittency', getQuantity(self.form.inputGammaInt)) storeIfChanged(self.obj, 'ReThetat', getQuantity(self.form.inputReThetat)) storeIfChanged(self.obj, 'TurbulentViscosity', getQuantity(self.form.inputTurbulentViscosity)) storeIfChanged(self.obj, 'kEqnTurbulentKineticEnergy', getQuantity(self.form.inputKineticEnergy)) storeIfChanged(self.obj, 'kEqnTurbulentViscosity', getQuantity(self.form.inputTurbulentViscosity)) storeIfChanged(self.obj, 'TurbulenceIntensityPercentage', getQuantity(self.form.inputIntensity)) storeIfChanged(self.obj, 'TurbulenceLengthScale', getQuantity(self.form.inputLengthScale)) # Multiphase storeIfChanged(self.obj, 'VolumeFractions', self.alphas) # Porous storeIfChanged(self.obj, 'PorousBaffleMethod', CfdFluidBoundary.POROUS_METHODS[self.form.buttonGroupPorous.checkedId()]) storeIfChanged(self.obj, 'PressureDropCoeff', getQuantity(self.form.inputPressureDropCoeff)) storeIfChanged(self.obj, 'ScreenWireDiameter', getQuantity(self.form.inputWireDiameter)) storeIfChanged(self.obj, 'ScreenSpacing', getQuantity(self.form.inputSpacing)) # Only update references if changed if self.obj.ShapeRefs != self.ShapeRefsOrig: refstr = "FreeCAD.ActiveDocument.{}.ShapeRefs = [\n".format(self.obj.Name) refstr += ',\n'.join( "(FreeCAD.ActiveDocument.getObject('{}'), {})".format(ref[0].Name, ref[1]) for ref in self.obj.ShapeRefs) refstr += "]" FreeCADGui.doCommand(refstr) # Default boundary defaultBoundary = self.form.checkBoxDefaultBoundary.isChecked() storeIfChanged(self.obj, 'DefaultBoundary', defaultBoundary) if defaultBoundary: # Deactivate previous default boundary, if any boundaries = CfdTools.getCfdBoundaryGroup(CfdTools.getParentAnalysisObject(self.obj)) for b in boundaries: if b.Name != self.obj.Name and b.DefaultBoundary: FreeCADGui.doCommand("FreeCAD.ActiveDocument.{}.DefaultBoundary = False".format(b.Name)) FreeCADGui.doCommand("FreeCAD.ActiveDocument.recompute()") doc = FreeCADGui.getDocument(self.obj.Document) doc.resetEdit()
def inputVolumeFractionChanged(self, value): self.alphas[self.form.comboFluid.currentText()] = getQuantity(self.form.inputVolumeFraction)
def accept(self): doc = FreeCADGui.getDocument(self.obj.Document) doc.resetEdit() # Velocity storeIfChanged(self.obj, 'PotentialFlow', self.form.radioButtonPotentialFlowU.isChecked()) storeIfChanged(self.obj, 'UseInletUValues', self.form.radioButtonUseInletValuesU.isChecked()) storeIfChanged(self.obj, 'Ux', getQuantity(self.form.Ux)) storeIfChanged(self.obj, 'Uy', getQuantity(self.form.Uy)) storeIfChanged(self.obj, 'Uz', getQuantity(self.form.Uz)) # Pressure storeIfChanged(self.obj, 'UseOutletPValue', self.form.radioButtonUseInletValuesP.isChecked()) storeIfChanged(self.obj, 'PotentialFlowP', self.form.radioButtonPotentialFlowP.isChecked()) storeIfChanged(self.obj, 'Pressure', getQuantity(self.form.pressure)) # Multiphase storeIfChanged(self.obj, 'VolumeFractions', self.alphas) # Thermal storeIfChanged(self.obj, 'UseInletTemperatureValue', self.form.checkUseInletValuesThermal.isChecked()) storeIfChanged(self.obj, 'Temperature', getQuantity(self.form.inputTemperature)) # Turbulence storeIfChanged(self.obj, 'UseInletTurbulenceValues', self.form.checkUseInletValuesTurb.isChecked()) storeIfChanged(self.obj, 'nuTilda', getQuantity(self.form.inputnuTilda)) storeIfChanged(self.obj, 'epsilon', getQuantity(self.form.inputEpsilon)) storeIfChanged(self.obj, 'omega', getQuantity(self.form.inputOmega)) storeIfChanged(self.obj, 'k', getQuantity(self.form.inputk)) storeIfChanged(self.obj, 'gammaInt', getQuantity(self.form.inputGammaInt)) storeIfChanged(self.obj, 'ReThetat', getQuantity(self.form.inputReThetat)) # LES storeIfChanged(self.obj, 'nut', getQuantity(self.form.inputTurbulentViscosity)) storeIfChanged(self.obj, 'kEqnk', getQuantity(self.form.inputkEqnKineticEnergy)) storeIfChanged(self.obj, 'kEqnNut', getQuantity(self.form.inputkEqnTurbulentViscosity)) boundaryU = self.form.comboBoundaryU.currentData() boundaryP = self.form.comboBoundaryP.currentData() boundaryT = self.form.comboBoundaryT.currentData() boundaryTurb = self.form.comboBoundaryTurb.currentData() if boundaryU and self.obj.UseInletUValues: if not self.obj.BoundaryU or boundaryU != self.obj.BoundaryU.Name: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryU = FreeCAD.ActiveDocument.{}" .format(self.obj.Name, boundaryU)) elif self.obj.BoundaryU: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryU = None".format( self.obj.Name)) if boundaryP and self.obj.UseOutletPValue: if not self.obj.BoundaryP or boundaryP != self.obj.BoundaryP.Name: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryP = FreeCAD.ActiveDocument.{}" .format(self.obj.Name, boundaryP)) elif self.obj.BoundaryP: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryP = None".format( self.obj.Name)) if boundaryT and self.obj.UseInletTemperatureValue: if not self.obj.BoundaryT or boundaryT != self.obj.BoundaryT.Name: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryT = FreeCAD.ActiveDocument.{}" .format(self.obj.Name, boundaryT)) elif self.obj.BoundaryT: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryT = None".format( self.obj.Name)) if boundaryTurb and self.obj.UseInletTurbulenceValues: if not self.obj.BoundaryTurb or boundaryTurb != self.obj.BoundaryTurb.Name: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryTurb = FreeCAD.ActiveDocument.{}" .format(self.obj.Name, boundaryTurb)) elif self.obj.BoundaryTurb: FreeCADGui.doCommand( "FreeCAD.ActiveDocument.{}.BoundaryTurb = None".format( self.obj.Name))
def accept(self): FreeCADGui.Selection.removeObserver(self) self.obj.Shape = self.ShapeOrig # Make sure shape is re-calculated before leaving edit mode FreeCAD.ActiveDocument.recompute() self.analysis_obj.NeedsMeshRewrite = self.NeedsMeshRewriteOrig FreeCADGui.ActiveDocument.resetEdit() # Macro script storeIfChanged(self.obj, 'RelativeLength', self.form.if_rellen.value()) if not self.mesh_obj.MeshUtility == 'gmsh': storeIfChanged(self.obj, 'RefinementThickness', getQuantity(self.form.if_refinethick)) if self.form.check_boundlayer.isChecked(): num_layers = self.form.if_numlayer.value() else: num_layers = 0 storeIfChanged(self.obj, 'NumberLayers', num_layers) storeIfChanged(self.obj, 'ExpansionRatio', self.form.if_expratio.value()) storeIfChanged(self.obj, 'FirstLayerHeight', getQuantity(self.form.if_firstlayerheight)) storeIfChanged(self.obj, 'RegionEdgeRefinement', self.form.if_edgerefinement.value()) storeIfChanged(self.obj, 'Internal', self.form.volumeRefinementToggle.isChecked()) storeIfChanged(self.obj, 'Extrusion', self.form.extrusionToggle.isChecked()) if self.obj.Extrusion: storeIfChanged( self.obj, 'ExtrusionType', CfdMeshRefinement.EXTRUSION_TYPES[ self.form.extrusionTypeCombo.currentIndex()]) storeIfChanged(self.obj, 'KeepExistingMesh', self.form.keepExistingMeshCheck.isChecked()) storeIfChanged(self.obj, 'ExtrusionThickness', getQuantity(self.form.thicknessInput)) storeIfChanged(self.obj, 'ExtrusionAngle', getQuantity(self.form.angleInput)) storeIfChanged(self.obj, 'ExtrusionLayers', self.form.numLayersInput.value()) storeIfChanged(self.obj, 'ExtrusionRatio', self.form.ratioInput.value()) new_point = FreeCAD.Vector( self.form.axisPointXEdit.property("quantity").Value, self.form.axisPointYEdit.property("quantity").Value, self.form.axisPointZEdit.property("quantity").Value) if self.obj.ExtrusionAxisPoint != new_point: FreeCADGui.doCommand( "App.ActiveDocument.{}.ExtrusionAxisPoint = App.{}".format( self.obj.Name, new_point)) new_dir = FreeCAD.Vector( self.form.axisDirectionXEdit.property("quantity").Value, self.form.axisDirectionYEdit.property("quantity").Value, self.form.axisDirectionZEdit.property("quantity").Value) if self.obj.ExtrusionAxisDirection != new_dir: FreeCADGui.doCommand( "App.ActiveDocument.{}.ExtrusionAxisDirection = App.{}". format(self.obj.Name, new_dir)) if self.obj.ShapeRefs != self.ShapeRefsOrig: refstr = "FreeCAD.ActiveDocument.{}.ShapeRefs = [\n".format( self.obj.Name) refstr += ',\n'.join( "(FreeCAD.ActiveDocument.getObject('{}'), {})".format( ref[0].Name, ref[1]) for ref in self.obj.ShapeRefs) refstr += "]" FreeCADGui.doCommand(refstr) FreeCADGui.doCommand("FreeCAD.ActiveDocument.recompute()") return True
def accept(self): self.analysis_obj.NeedsCaseRewrite = self.NeedsCaseRewriteOrig if self.obj.Name.startswith('PorousZone'): storeIfChanged( self.obj, 'PorousCorrelation', CfdZone.POROUS_CORRELATIONS[ self.form.comboBoxCorrelation.currentIndex()]) storeIfChanged(self.obj, 'D1', getQuantity(self.form.dx)) storeIfChanged(self.obj, 'D2', getQuantity(self.form.dy)) storeIfChanged(self.obj, 'D3', getQuantity(self.form.dz)) storeIfChanged(self.obj, 'F1', getQuantity(self.form.fx)) storeIfChanged(self.obj, 'F2', getQuantity(self.form.fy)) storeIfChanged(self.obj, 'F3', getQuantity(self.form.fz)) e1 = FreeCAD.Vector( self.form.e1x.property('quantity').getValueAs("1").Value, self.form.e1y.property('quantity').getValueAs("1").Value, self.form.e1z.property('quantity').getValueAs("1").Value) e2 = FreeCAD.Vector( self.form.e2x.property('quantity').getValueAs("1").Value, self.form.e2y.property('quantity').getValueAs("1").Value, self.form.e2z.property('quantity').getValueAs("1").Value) e3 = FreeCAD.Vector( self.form.e3x.property('quantity').getValueAs("1").Value, self.form.e3y.property('quantity').getValueAs("1").Value, self.form.e3z.property('quantity').getValueAs("1").Value) storeIfChanged(self.obj, 'e1', e1) storeIfChanged(self.obj, 'e2', e2) storeIfChanged(self.obj, 'e3', e3) storeIfChanged(self.obj, 'OuterDiameter', getQuantity(self.form.inputOuterDiameter)) tube_axis = FreeCAD.Vector( self.form.inputTubeAxisX.property('quantity').getValueAs( "1").Value, self.form.inputTubeAxisY.property('quantity').getValueAs( "1").Value, self.form.inputTubeAxisZ.property('quantity').getValueAs( "1").Value) storeIfChanged(self.obj, 'TubeAxis', tube_axis) storeIfChanged(self.obj, 'TubeSpacing', getQuantity(self.form.inputTubeSpacing)) spacing_direction = FreeCAD.Vector( self.form.inputBundleLayerNormalX.property( 'quantity').getValueAs("1").Value, self.form.inputBundleLayerNormalY.property( 'quantity').getValueAs("1").Value, self.form.inputBundleLayerNormalZ.property( 'quantity').getValueAs("1").Value) storeIfChanged(self.obj, 'SpacingDirection', spacing_direction) storeIfChanged(self.obj, 'AspectRatio', getQuantity(self.form.inputAspectRatio)) storeIfChanged(self.obj, 'VelocityEstimate', getQuantity(self.form.inputVelocityEstimate)) elif self.obj.Name.startswith('InitialisationZone'): storeIfChanged(self.obj, 'VelocitySpecified', self.form.checkVelocity.isChecked()) storeIfChanged(self.obj, 'Ux', getQuantity(self.form.inputUx)) storeIfChanged(self.obj, 'Uy', getQuantity(self.form.inputUy)) storeIfChanged(self.obj, 'Uz', getQuantity(self.form.inputUz)) storeIfChanged(self.obj, 'PressureSpecified', self.form.checkPressure.isChecked()) storeIfChanged(self.obj, 'Pressure', getQuantity(self.form.inputPressure)) storeIfChanged(self.obj, 'VolumeFractionSpecified', self.form.checkAlpha.isChecked()) storeIfChanged(self.obj, 'VolumeFractions', self.alphas) if self.obj.ShapeRefs != self.ShapeRefsOrig: refstr = "FreeCAD.ActiveDocument.{}.ShapeRefs = [\n".format( self.obj.Name) refstr += ',\n'.join( "(FreeCAD.ActiveDocument.getObject('{}'), {})".format( ref[0].Name, ref[1]) for ref in self.obj.ShapeRefs) refstr += "]" FreeCADGui.doCommand(refstr) doc = FreeCADGui.getDocument(self.obj.Document) doc.resetEdit()
def inputVolumeFractionChanged(self, text): alphaName = self.form.comboFluid.currentText() self.alphas[alphaName] = getQuantity(self.form.inputVolumeFraction)