3 Replies Latest reply on May 21, 2016 6:53 AM by Deepak Gupta

    How can I get a profile Size for Weldment structural member via API?

    Sanya Shmidt

      Hello!

      I have a Weldment assembly - lots of  structural members in the tree Named Structural Member 1/2/3 etc....

       

      When you go to Edit Structural Member you can change a weldment profile:

       

      Do you guys know how to get the structural member Size (circled above) via API?

      Any ideas or links to similar topics very appreciated.

       

      Thank you.

        • Re: How can I get a profile Size for Weldment structural member via API?
          Deepak Gupta

          Check WeldmentProfilePath in API help files.

            • Re: How can I get a profile Size for Weldment structural member via API?
              Sanya Shmidt

              Thanks,

              Deepak, its not very clear to me how to get to that property. I can get a structural body name using the swBody feature (im using drawings to get all bodies)

               

              Any help here?

               

              Thank you.

               

                         Dim swWeldFeat As Feature

                       Dim swWeldFeatData As StructuralMemberFeatureData

               

               

                      swModel = swApp.ActiveDoc

                      swSelMgr = swModel.SelectionManager

               

                      swView = swSelMgr.GetSelectedObject6(1, -1)

               

                      nbrBodies = swView.GetBodiesCount

               

                      arrBody = swView.Bodies

               

                      For i = 0 To UBound(arrBody)

                          swBody = arrBody(i)

                          swSelData = swSelMgr.CreateSelectData

                          swSelData.View = swView

                          bool = swBody.Select2(False, swSelData)

               

                          objType = swSelMgr.GetSelectedObjectType3(1, -1)

               

                          ' adding Descriptions on to the combo box

                          If Mid(swBody.GetSelectionId, 1, 17) = "Structural Member" Then

                              ComboBox1.Items.Add(swBody.Name)

                         End If

               

              ' so here I`d like to show the Profile SIZE but dont know how to get to it.

                 Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged

                      swModel.ClearSelection2(True)

                      boolstatus = swModel.Extension.SelectByID2(ComboBox1.SelectedItem, "BODYFEATURE", 0, 0, 0, True, 0, Nothing, 0)

                      swWeldFeat = swSelMgr.GetSelectedObject6(1, 0)

                      swWeldFeatData = swWeldFeat.GetDefinition ' ERROR Additional information: Object reference not set to an instance of an object.

                      MessageBox.Show("Path : " & swWeldFeatData.WeldmentProfilePath)

               

                   end sub

               

               

              To be able to achieve that I have to switch to the weldment model (I guess I could do that but still curious if I can use drawings reference.)

               

              Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged

               

                      swModel.ClearSelection2(True)

                      swApp.ActivateDoc2("210363 10 Weldment", False, longstatus)

                      swModel = swApp.ActiveDoc

                      swSelMgr = swModel.SelectionManager

                      boolstatus = swModel.Extension.SelectByID2(ComboBox1.SelectedItem, "BODYFEATURE", 0, 0, 0, True, 0, Nothing, 0)

                      swWeldFeat = swSelMgr.GetSelectedObject6(1, 0)

                      swWeldFeatData = swWeldFeat.GetDefinition

                      MessageBox.Show("Path : " & swWeldFeatData.WeldmentProfilePath)