예제 #1
0
 def addSelection(self,doc,obj,sub,pnt):
     if self.beam==None and FreeCAD.getDocument(doc).getObject(obj).TypeId=='Part::FeaturePython':
       self.beam=FreeCAD.getDocument(doc).getObject(obj)
       FreeCAD.Console.PrintMessage('Beam type selected.\n')
     else:
       subObject=FreeCAD.getDocument(doc).getObject(obj).Shape.getElement(sub)
       if subObject.ShapeType=="Edge" and self.beam!=None:
         frameCmd.placeTheBeam(FreeCAD.activeDocument().copyObject(self.beam,True),subObject)
예제 #2
0
 def addSelection(self, doc, obj, sub, pnt):
     if self.beam == None and FreeCAD.getDocument(doc).getObject(
             obj).TypeId == 'Part::FeaturePython':
         self.beam = FreeCAD.getDocument(doc).getObject(obj)
         FreeCAD.Console.PrintMessage('Beam type selected.\n')
     else:
         subObject = FreeCAD.getDocument(doc).getObject(
             obj).Shape.getElement(sub)
         if subObject.ShapeType == "Edge" and self.beam != None:
             frameCmd.placeTheBeam(
                 FreeCAD.activeDocument().copyObject(self.beam, True),
                 subObject)
예제 #3
0
 def accept(self):
   if self.beam!=None and len(frameCmd.edges())>0:
     FreeCAD.activeDocument().openTransaction('Fill frame')
     if self.form.radio1.isChecked():
       frameCmd.placeTheBeam(self.beam,frameCmd.edges()[0])
     else:
       for edge in frameCmd.edges():
         struct=FreeCAD.activeDocument().copyObject(self.beam,True)
         frameCmd.placeTheBeam(struct,edge)
       FreeCAD.activeDocument().recompute()
     FreeCAD.ActiveDocument.recompute()
     FreeCAD.activeDocument().commitTransaction()
예제 #4
0
 def accept(self):
   if self.beam!=None and len(frameCmd.edges())>0:
     FreeCAD.activeDocument().openTransaction('Fill frame')
     if self.form.radio1.isChecked():
       frameCmd.placeTheBeam(self.beam,frameCmd.edges()[0])
     else:
       for edge in frameCmd.edges():
         struct=FreeCAD.activeDocument().copyObject(self.beam,True)
         frameCmd.placeTheBeam(struct,edge)
       FreeCAD.activeDocument().recompute()
     FreeCAD.ActiveDocument.recompute()
     FreeCAD.activeDocument().commitTransaction()
예제 #5
0
 def addSelection(self,doc,obj,sub,pnt):
   selex=FreeCADGui.Selection.getSelectionEx()
   if self.beam==None and hasattr(selex[len(selex)-1].Object,'Height'):
     self.beam=selex[len(selex)-1].Object
     FreeCAD.Console.PrintMessage('Beam selected\n')
   elif self.edge==None and selex[len(selex)-1].SubObjects[0].ShapeType=='Edge':
     self.edge=selex[len(selex)-1].SubObjects[0]
     FreeCAD.Console.PrintMessage('Edge selected\n')
   if self.edge!=None and self.beam!=None:
     frameCmd.placeTheBeam(self.beam,self.edge)
     FreeCAD.Console.PrintMessage('Beam placed.\n')
     FreeCAD.Console.PrintWarning('Select another beam and another edge.\n[ESC] to exit.\n')
     self.beam=self.edge=None
     FreeCAD.activeDocument().recompute()
예제 #6
0
 def addSelection(self, doc, obj, sub, pnt):
     selex = FreeCADGui.Selection.getSelectionEx()
     if self.beam == None and hasattr(selex[len(selex) - 1].Object,
                                      'Height'):
         self.beam = selex[len(selex) - 1].Object
         FreeCAD.Console.PrintMessage('Beam selected\n')
     elif self.edge == None and selex[len(selex) -
                                      1].SubObjects[0].ShapeType == 'Edge':
         self.edge = selex[len(selex) - 1].SubObjects[0]
         FreeCAD.Console.PrintMessage('Edge selected\n')
     if self.edge != None and self.beam != None:
         frameCmd.placeTheBeam(self.beam, self.edge)
         FreeCAD.Console.PrintMessage('Beam placed.\n')
         FreeCAD.Console.PrintWarning(
             'Select another beam and another edge.\n[ESC] to exit.\n')
         self.beam = self.edge = None
         FreeCAD.activeDocument().recompute()
예제 #7
0
 def update(self,fp,copyProfile=True):
   if hasattr(fp.Base,'Shape'):
     edges=fp.Base.Shape.Edges
     if not edges:
       FreeCAD.Console.PrintError('Base has not valid edges\n')
       return
   group=FreeCAD.activeDocument().getObjectsByLabel(fp.Group)[0]
   if fp.Profile:
     FreeCAD.activeDocument().openTransaction('Update frameLine')
     for e in edges:
       if copyProfile:
         p=FreeCAD.activeDocument().copyObject(fp.Profile,True)
       else:
         p=fp.Profile
       beam=makeStructure(p)
       frameCmd.placeTheBeam(beam,e)
       pipeCmd.moveToPyLi(beam,fp.Name)
     FreeCAD.activeDocument().commitTransaction()
   FreeCAD.activeDocument().recompute()
예제 #8
0
 def makeSingle(self):
   FreeCAD.activeDocument().openTransaction('Insert Single Struct')
   if self.SType=='<by sketch>':
     profile=FreeCAD.ActiveDocument.getObjectsByLabel(self.form.listSizes.currentItem().text())[0]
   else:
     prop=self.sectDictList[self.form.listSizes.currentRow()]
     profile=newProfile(prop)
   if frameCmd.faces():
     Z=FreeCAD.Vector(0,0,1)
     for f in frameCmd.faces():
       beam=makeStructure(profile)
       beam.Placement=FreeCAD.Placement(f.CenterOfMass,FreeCAD.Rotation(Z,f.normalAt(0,0)))
       if self.form.editLength.text(): beam.Height=float(self.form.editLength.text())
   else:
     for e in frameCmd.edges():
       beam=makeStructure(profile)
       frameCmd.placeTheBeam(beam,e)
       if self.form.editLength.text(): beam.Height=float(self.form.editLength.text())
   FreeCAD.ActiveDocument.recompute()
예제 #9
0
 def update(self, fp, copyProfile=True):
     if hasattr(fp.Base, 'Shape'):
         edges = fp.Base.Shape.Edges
         if not edges:
             FreeCAD.Console.PrintError('Base has not valid edges\n')
             return
     group = FreeCAD.activeDocument().getObjectsByLabel(fp.Group)[0]
     if fp.Profile:
         FreeCAD.activeDocument().openTransaction('Update frameLine')
         for e in edges:
             if copyProfile:
                 p = FreeCAD.activeDocument().copyObject(fp.Profile, True)
             else:
                 p = fp.Profile
             beam = makeStructure(p)
             frameCmd.placeTheBeam(beam, e)
             pipeCmd.moveToPyLi(beam, fp.Name)
         FreeCAD.activeDocument().commitTransaction()
     FreeCAD.activeDocument().recompute()
예제 #10
0
 def insert(self):
   from pipeCmd import moveToPyLi
   if self.combo.currentText()=='<new>':
     name=self.edit1.text()
     if not name: name='Telaio'
     a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
     FrameLine(a)
     a.ViewObject.Proxy=0
     self.combo.addItem(a.Label)
     self.combo.setCurrentIndex(self.combo.count()-1)
     if self.sectList.selectedItems():
       self.getProfile()
   elif self.sectList.selectedItems():
     prof= FreeCAD.ActiveDocument.getObjectsByLabel(self.sectList.selectedItems()[0].text())[0]
     for e in frameCmd.edges():
       if self.cb1.isChecked():
         s=makeStructure(FreeCAD.ActiveDocument.copyObject(prof))
       else:
         s=makeStructure(prof)
       frameCmd.placeTheBeam(s,e)
       moveToPyLi(s,self.current.Name)
     FreeCAD.ActiveDocument.recompute()
예제 #11
0
 def makeSingle(self):
     FreeCAD.activeDocument().openTransaction('Insert Single Struct')
     if self.SType == '<by sketch>':
         profile = FreeCAD.ActiveDocument.getObjectsByLabel(
             self.form.listSizes.currentItem().text())[0]
     else:
         prop = self.sectDictList[self.form.listSizes.currentRow()]
         profile = newProfile(prop)
     if frameCmd.faces():
         Z = FreeCAD.Vector(0, 0, 1)
         for f in frameCmd.faces():
             beam = makeStructure(profile)
             beam.Placement = FreeCAD.Placement(
                 f.CenterOfMass, FreeCAD.Rotation(Z, f.normalAt(0, 0)))
             if self.form.editLength.text():
                 beam.Height = float(self.form.editLength.text())
     else:
         for e in frameCmd.edges():
             beam = makeStructure(profile)
             frameCmd.placeTheBeam(beam, e)
             if self.form.editLength.text():
                 beam.Height = float(self.form.editLength.text())
     FreeCAD.ActiveDocument.recompute()
예제 #12
0
 def insert(self):
     from pipeCmd import moveToPyLi
     if self.combo.currentText() == '<new>':
         name = self.edit1.text()
         if not name: name = 'Telaio'
         a = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", name)
         FrameLine(a)
         a.ViewObject.Proxy = 0
         self.combo.addItem(a.Label)
         self.combo.setCurrentIndex(self.combo.count() - 1)
         if self.sectList.selectedItems():
             self.getProfile()
     elif self.sectList.selectedItems():
         prof = FreeCAD.ActiveDocument.getObjectsByLabel(
             self.sectList.selectedItems()[0].text())[0]
         for e in frameCmd.edges():
             if self.cb1.isChecked():
                 s = makeStructure(FreeCAD.ActiveDocument.copyObject(prof))
             else:
                 s = makeStructure(prof)
             frameCmd.placeTheBeam(s, e)
             moveToPyLi(s, self.current.Name)
         FreeCAD.ActiveDocument.recompute()
예제 #13
0
 def insert(self):
     from frameCmd import makeFrameLine, edges, placeTheBeam
     from pipeCmd import moveToPyLi
     if self.combo.currentText() == '<new>':
         n = self.edit1.text()
         if n:
             a = makeFrameLine(name=n)
         else:
             a = makeFrameLine()
         self.combo.addItem(a.Label)
         self.combo.setCurrentIndex(self.combo.count() - 1)
         if self.sectList.selectedItems():
             self.getProfile()
     elif self.sectList.selectedItems():
         prof = FreeCAD.ActiveDocument.getObjectsByLabel(
             self.sectList.selectedItems()[0].text())[0]
         for e in edges():
             if self.cb1.isChecked():
                 s = makeStructure(FreeCAD.ActiveDocument.copyObject(prof))
             else:
                 s = makeStructure(prof)
             placeTheBeam(s, e)
             moveToPyLi(s, self.current.Name)
         FreeCAD.ActiveDocument.recompute()