<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Delete component from assembly in Customization</title>
    <link>https://www.ptcusercommunity.com/t5/Customization/Delete-component-from-assembly/m-p/1052269#M14709</link>
    <description>&lt;P&gt;Thanks for this info.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jan 2026 17:48:11 GMT</pubDate>
    <dc:creator>jbryant74</dc:creator>
    <dc:date>2026-01-26T17:48:11Z</dc:date>
    <item>
      <title>Delete component from assembly</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/Delete-component-from-assembly/m-p/1052253#M14707</link>
      <description>&lt;P&gt;Help to see what I am missing.&amp;nbsp;&lt;BR /&gt;I want to find the first component in the assembly and delete it.&lt;BR /&gt;I can find the first component, but having trouble deleting.&lt;BR /&gt;&lt;BR /&gt;Here is my run method&lt;/P&gt;&lt;LI-CODE lang="java"&gt;public void run() throws jxthrowable, IOException {
        Session session = pfcSession.GetCurrentSession();
        Model model = session.GetActiveModel();

        if (model == null) {
            return;
        }

        if (model.GetType() == ModelType.MDL_ASSEMBLY) {
            Assembly assembly = (Assembly) model;

            Features components = assembly.ListFeaturesByType(false, FeatureType.FEATTYPE_COMPONENT);

            if (components.getarraysize() &amp;gt; 0) {
                try {
                    // --- Find the first component in the model tree
                    ComponentFeat targetComponent = null;

                    // Get all features in order.
                    Features allFeatures = assembly.ListFeaturesByType(false, null);

                    // Find the first component feature in the feature tree
                    for (int i = 0; i &amp;lt; allFeatures.getarraysize(); i++) {
                        Feature feat = allFeatures.get(i);
                        if (feat instanceof ComponentFeat) {
                            targetComponent = (ComponentFeat) feat;
                            break; // Stop at the first component found
                        }
                    }

                    ModelDescriptor desc = targetComponent.GetModelDescr();
                    
                    FeatureOperations featOps = FeatureOperations.create();
                    featOps.append(targetComponent.CreateDeleteOp());
                    assembly.ExecuteFeatureOps(featOps, null);
                    assembly.Regenerate(null);

                    session.GetModelWindow(assembly).Repaint();

                } catch (jxthrowable e) {
                    System.out.println("Error during component deletion: " + e.getMessage());
                }
            } else {
                System.out.println("No components to delete.");
            }
        } else {
            System.out.println("The active model is not an assembly.");
        }
    }&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 26 Jan 2026 16:00:28 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/Delete-component-from-assembly/m-p/1052253#M14707</guid>
      <dc:creator>jbryant74</dc:creator>
      <dc:date>2026-01-26T16:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Delete component from assembly</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/Delete-component-from-assembly/m-p/1052267#M14708</link>
      <description>&lt;P&gt;PTC removed&amp;nbsp;ExecuteFeatureOps() from jlink in Creo Parametric 7.0. You will have to create a macro to delete a component.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.ptc.com/en/support/article/CS8883" target="_blank"&gt;https://www.ptc.com/en/support/article/CS8883&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.ptc.com/en/support/article/CS340286" target="_blank"&gt;https://www.ptc.com/en/support/article/CS340286&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.ptc.com/en/support/article/CS367218" target="_blank"&gt;https://www.ptc.com/en/support/article/CS367218&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.ptc.com/t5/Customization/In-Creo-5-ExecuteFeatureOps-fails-with-an-exception/m-p/830291#M11674%3Fsource=search" target="_blank"&gt;https://community.ptc.com/t5/Customization/In-Creo-5-ExecuteFeatureOps-fails-with-an-exception/m-p/830291#M11674%3Fsource=search&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2026 17:45:58 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/Delete-component-from-assembly/m-p/1052267#M14708</guid>
      <dc:creator>RandyJones</dc:creator>
      <dc:date>2026-01-26T17:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Delete component from assembly</title>
      <link>https://www.ptcusercommunity.com/t5/Customization/Delete-component-from-assembly/m-p/1052269#M14709</link>
      <description>&lt;P&gt;Thanks for this info.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jan 2026 17:48:11 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Customization/Delete-component-from-assembly/m-p/1052269#M14709</guid>
      <dc:creator>jbryant74</dc:creator>
      <dc:date>2026-01-26T17:48:11Z</dc:date>
    </item>
  </channel>
</rss>

