<?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 bottom part of boundary automatically? in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12421786#M2745</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;FUNCTION Main() {
	ENTITY $bound = entity('Boundary','')

	INT $count = segments($bound)
	INT $targetIndex = -1
	REAL $targetZMax = 0

	WHILE $count &amp;gt; 0 {
		$count = $count -1

		EDIT BOUNDARY ; DESELECT ALL
		EDIT BOUNDARY ; SELECT $count
		
		REAL $zMAx = 0
		CALL GetZMax($zMAx)
		IF $zMAx &amp;gt; $targetZMax {
			$targetIndex = $count
			$targetZMax = zMAx
		}
	}

	IF $targetIndex &amp;gt; -1 {

		$count = segments($bound)

		WHILE $count &amp;gt; 0 {
			$count = $count -1
			
			IF $count != $targetIndex {
				EDIT BOUNDARY ; DESELECT ALL
				EDIT BOUNDARY ; SELECT $count
				DELETE BOUNDARY ; SELECTED
			}

		}

	}
}

FUNCTION GetZMax(OUTPUT REAL $zMAx) {
	
	EDIT BLOCKTYPE BOX
	EDIT BLOCK COORDINATE WORKPLANE
	EDIT BLOCK ALL UNLOCK
	EDIT BLOCK LIMITTYPE BOUNDARY
	EDIT BLOCK RESET
	EDIT BLOCK LIMITTYPE MODEL
	
	$zMAx = $Block.Limits.ZMax

}

&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 05 Dec 2023 20:39:52 GMT</pubDate>
    <dc:creator>ondrej.mikulec</dc:creator>
    <dc:date>2023-12-05T20:39:52Z</dc:date>
    <item>
      <title>Delete bottom part of boundary automatically?</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12421323#M2744</link>
      <description>&lt;P&gt;Fellas,&lt;/P&gt;&lt;P&gt;Looking for a way to delete this bottom section of boundary automatically with no user intervention using colors and a user boundary. I want to select the color on the inside of this pocket or pockets and just use the top section.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johnc4668_0-1701795373425.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1301097i432876AD00CF93C3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="johnc4668_0-1701795373425.png" alt="johnc4668_0-1701795373425.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 16:56:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12421323#M2744</guid>
      <dc:creator>johnc4668</dc:creator>
      <dc:date>2023-12-05T16:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Delete bottom part of boundary automatically?</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12421786#M2745</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;FUNCTION Main() {
	ENTITY $bound = entity('Boundary','')

	INT $count = segments($bound)
	INT $targetIndex = -1
	REAL $targetZMax = 0

	WHILE $count &amp;gt; 0 {
		$count = $count -1

		EDIT BOUNDARY ; DESELECT ALL
		EDIT BOUNDARY ; SELECT $count
		
		REAL $zMAx = 0
		CALL GetZMax($zMAx)
		IF $zMAx &amp;gt; $targetZMax {
			$targetIndex = $count
			$targetZMax = zMAx
		}
	}

	IF $targetIndex &amp;gt; -1 {

		$count = segments($bound)

		WHILE $count &amp;gt; 0 {
			$count = $count -1
			
			IF $count != $targetIndex {
				EDIT BOUNDARY ; DESELECT ALL
				EDIT BOUNDARY ; SELECT $count
				DELETE BOUNDARY ; SELECTED
			}

		}

	}
}

FUNCTION GetZMax(OUTPUT REAL $zMAx) {
	
	EDIT BLOCKTYPE BOX
	EDIT BLOCK COORDINATE WORKPLANE
	EDIT BLOCK ALL UNLOCK
	EDIT BLOCK LIMITTYPE BOUNDARY
	EDIT BLOCK RESET
	EDIT BLOCK LIMITTYPE MODEL
	
	$zMAx = $Block.Limits.ZMax

}

&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Dec 2023 20:39:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12421786#M2745</guid>
      <dc:creator>ondrej.mikulec</dc:creator>
      <dc:date>2023-12-05T20:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Delete bottom part of boundary automatically?</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12422675#M2746</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5338417"&gt;@johnc4668&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to suggest a macro code to get the top section. Hope this's work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;ENTITY $bound = entity('Boundary','')&lt;/DIV&gt;&lt;DIV&gt;INT $count = segments($bound)&lt;/DIV&gt;&lt;DIV&gt;INT $i = 1&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;EDIT BOUNDARY $bound.name CURVEEDITOR START&lt;/DIV&gt;&lt;DIV&gt;CURVEEDITOR REORDER SORT STARTZ&lt;/DIV&gt;&lt;DIV&gt;WHILE $i&amp;nbsp; &amp;lt; $count {&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CURVEEDITOR REORDER LISTUPDATE\r 0 NEW&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CURVEEDITOR DELETE SELECTED &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$i = $i + 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;CURVEEDITOR FINISH ACCEPT&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:53:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12422675#M2746</guid>
      <dc:creator>nguyenthinhvt95</dc:creator>
      <dc:date>2023-12-06T07:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete bottom part of boundary automatically?</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12423068#M2747</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4786280"&gt;@nguyenthinhvt95&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked great! But it wants to delete every boundary except one. Im looking to keep all the boundaries at the top surface and delete anything below the top or below z zero.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johnc4668_0-1701866424508.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1301455i2A8CC4EA5556F091/image-size/medium?v=v2&amp;amp;px=400" role="button" title="johnc4668_0-1701866424508.png" alt="johnc4668_0-1701866424508.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="johnc4668_1-1701866755311.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1301458iFFC924BBADCD6500/image-size/medium?v=v2&amp;amp;px=400" role="button" title="johnc4668_1-1701866755311.png" alt="johnc4668_1-1701866755311.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 12:46:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12423068#M2747</guid>
      <dc:creator>johnc4668</dc:creator>
      <dc:date>2023-12-06T12:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Delete bottom part of boundary automatically?</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12424304#M2748</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I changed things to:&lt;BR /&gt;The first loop finds the highest ZMax.&lt;BR /&gt;The second loop removes what's not in ZMax and keeps &lt;STRONG&gt;all&lt;/STRONG&gt; that is.&lt;BR /&gt;The third loop goes through each segment, copying the boundaries for each one.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;FUNCTION Main() {
	ENTITY $bound = entity('Boundary','')

	INT $count = segments($bound)
	REAL $targetZMax = 0

	WHILE $count &amp;gt; 0 {
		$count = $count -1

		EDIT BOUNDARY ; DESELECT ALL
		EDIT BOUNDARY ; SELECT $count
		
		REAL $zMAx = 0
		CALL GetZMax($zMAx)
		IF $round($zMAx,3) &amp;gt; $round($targetZMax,3) {
			$targetZMax = zMAx
		}
	}



	$count = segments($bound)

	WHILE $count &amp;gt; 0 {
		$count = $count -1
		
		EDIT BOUNDARY ; DESELECT ALL
		EDIT BOUNDARY ; SELECT $count
		
		REAL $zMAx = 0
		CALL GetZMax($zMAx)
		IF $round($zMAx,3) != $round($targetZMax,3) {
			EDIT BOUNDARY ; DESELECT ALL
			EDIT BOUNDARY ; SELECT $count
			DELETE BOUNDARY ; SELECTED
		}

	}


	
	$count = segments($bound)
	
	WHILE $count &amp;gt; 0 {
		$count = $count -1

		EDIT BOUNDARY ; DESELECT ALL
		EDIT BOUNDARY ; SELECT $count
		COPY BOUNDARY ; SELECTED
	}
}

FUNCTION GetZMax(OUTPUT REAL $zMAx) {
	
	EDIT BLOCKTYPE BOX
	EDIT BLOCK COORDINATE WORKPLANE
	EDIT BLOCK ALL UNLOCK
	EDIT BLOCK LIMITTYPE BOUNDARY
	EDIT BLOCK RESET
	EDIT BLOCK LIMITTYPE MODEL
	
	$zMAx = $Block.Limits.ZMax

}

&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 20:40:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12424304#M2748</guid>
      <dc:creator>ondrej.mikulec</dc:creator>
      <dc:date>2023-12-06T20:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Delete bottom part of boundary automatically?</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12424341#M2749</link>
      <description>I owe you a beer for this! thank you!! I'll take it from here!</description>
      <pubDate>Wed, 06 Dec 2023 20:55:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/delete-bottom-part-of-boundary-automatically/m-p/12424341#M2749</guid>
      <dc:creator>johnc4668</dc:creator>
      <dc:date>2023-12-06T20:55:21Z</dc:date>
    </item>
  </channel>
</rss>

