5 Replies Latest reply on Feb 14, 2013 5:09 PM by Valkyrie Savage

    SetEndCondition swEndCondUpToBody

    Valkyrie Savage

      Hi, all,

       

      I have an assembly where I'm trying to extrude some features from body A upToBody B.  I can't figure out what order to perform the selects and setEndCondition and setEndConditionReference in, and I can't figure out how the marks should go.  My function is below:

       

              private Component2 fieldOfView;

       

              private void lengthenExtrusion(Feature feature, Component2 swComponent, IConfiguration configToEdit)

              {

                  String[] configurationContainer = { configToEdit.Name };

                  ExtrudeFeatureData2 extrusion = feature.GetDefinition();

                  extrusion.AccessSelections(swAssembly, swComponent);

                  swComponent.Select2(false, 1 << 0);

                  extrusion.SetEndCondition(true, (int)swEndConditions_e.swEndCondUpToBody);

                  fieldOfView.Select2(true, 1 << 1);

                  extrusion.SetEndConditionReference(true, fieldOfView);

                  extrusion.SetChangeToConfigurations((int)swInConfigurationOpts_e.swThisConfiguration, configurationContainer);

                  feature.ModifyDefinition(extrusion, swDoc, swComponent);

                  swDoc.ForceRebuild3(true);

                  swComponent.DeSelect();

                  fieldOfView.DeSelect();

              }

       

       

      I want to extrude "extrusion" up to the body "fieldOfView".  I tried recording a macro to see how the marks work, but the recorder didn't capture the end condition changing.  Is there documentation somewhere about what to set marks to for functions that require them?

        • Re: SetEndCondition swEndCondUpToBody
          Artem Taturevych

          I do not think you need selection because you are passing pointer directly. Just for sure the pointer to the feature you are passing to the function is from assembly or from part context? How do you retrieve this pointer?

          __________________________

          Regards,

          Artem Taturevych

          Application Engineer at Intercad

          http://intercad.com.au/

          Tel: +61 2 9454 4444

            • Re: SetEndCondition swEndCondUpToBody
              Valkyrie Savage

              I am getting it via what amounts to the example code of traversing all the components in the assembly and selecting the one whose name has a substring I'm interested in.  It's coming from the same assembly.

                • Re: SetEndCondition swEndCondUpToBody
                  Valkyrie Savage

                  So I have tried extrusion.SetEndConditionReference(true, XXXXXX); with both the whole part (since I'm in an assembly) and the feature of the part that will terminate the extrusion.  Neither one did anything?  Am I not doing this call right?

                    • Re: SetEndCondition swEndCondUpToBody
                      Artem Taturevych

                      I have been able to successfully change the conditions within the part (when body belongs to the same part) but in context of the assembly it fails. Could you please confirm that you are trying to create an extrusion up to body in different component within an assembly (in-context references)?;

                       

                      private void ChangeEndConditions(IFeature feat, IBody2 body)

                      {

                          m_Doc.ClearSelection2(true);

                       

                          ExtrudeFeatureData2 extrData = feat.GetDefinition() as ExtrudeFeatureData2;

                       

                          if (extrData != null)

                          {

                              extrData.AccessSelections(m_Doc, null);

                              extrData.SetEndCondition(true, (int)swEndConditions_e.swEndCondUpToBody);

                              extrData.SetEndConditionReference(true, body);

                              extrData.ReverseDirection = true;

                              feat.ModifyDefinition(extrData, m_Doc, null);

                          }

                      }

                      __________________________

                      Regards,

                      Artem Taturevych

                      Application Engineer at Intercad

                      http://intercad.com.au/

                      Tel: +61 2 9454 4444