<?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: How to call SurroundsPoint(Point2 p) API function from maxscript in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13222768#M240</link>
    <description>&lt;P&gt;OK, it looks like the .shape_ property is only available for some shape types. I found another forum thread on a similar topic:&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/3ds-max-programming/spline-normalize-2-extend-modifier-how-can-i-snapshot-as-spline/m-p/12833562/highlight/true#M32309" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/3ds-max-programming/spline-normalize-2-extend-modifier-how-can-i-snapshot-as-spline/m-p/12833562/highlight/true#M32309&lt;/A&gt;&amp;nbsp;where Denis shows how to use MakeBezier to get the shape for a Line object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With that, I was able to get your SurroundsPoint call working:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;-- create a new Point2 value with coordinates [1,2]
p = g.point2.create 1 2
-- shp is the current spline
shp.SurroundsPoint p&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know whether this actually does what you need, but at least it now returns "false" instead of an error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Fri, 20 Dec 2024 17:27:31 GMT</pubDate>
    <dc:creator>MartinBeh</dc:creator>
    <dc:date>2024-12-20T17:27:31Z</dc:date>
    <item>
      <title>How to call SurroundsPoint(Point2 p) API function from maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13220769#M237</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm trying to test splines intersections and "hollows" by using some functions from the api inside maxscript. This example is based on a code found on internet but I'm not able to call SurroundsPoint(Point2 p), apparently I'm not able to pass a point2 value to that function.&lt;/P&gt;&lt;P&gt;Can someone help me with this? thanks a lot&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(
  g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
  inode = g.coreinterface7.getinodebyhandle $.inode.handle
  shp = ((inode.EvalWorldState (int currenttime) true).obj).shape_
  splines = for i=0 to shp.SplineCount-1 collect shp.GetSpline i
  
  for i=1 to splines.count do
  (
    format "isClockWise %\n" (splines[i].isClockWise)
    format "matID %\n" (splines[i].getMatID 1 )
    --without parameters the function is recognized
    format "SurroundsPoint %\n" ( splines[i].SurroundsPoint )
    --THIS GIVES AN ERROR
    --format "SurroundsPoint %\n" ( splines[i].SurroundsPoint [0,0] )
    format "Spline % is self-intersecting: %\n" i (splines[i].SelfIntersects)
    for j=i+1 to splines.count where splines[i].IntersectsSpline splines[j] do
    (
      format "Spline % intersects spline %\n" i j
    )
  )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2024 16:29:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13220769#M237</guid>
      <dc:creator>gastonDTKNS</dc:creator>
      <dc:date>2024-12-19T16:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to call SurroundsPoint(Point2 p) API function from maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13222333#M238</link>
      <description>&lt;P&gt;This seems to be incorrect?&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;shp = ((inode.EvalWorldState (int currenttime) true).obj).shape_&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 20 Dec 2024 12:55:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13222333#M238</guid>
      <dc:creator>MartinBeh</dc:creator>
      <dc:date>2024-12-20T12:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to call SurroundsPoint(Point2 p) API function from maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13222604#M239</link>
      <description>&lt;P&gt;Honestly I don't know! I try to learn this kind of stuffs by comparing codes, I took this one from here&lt;BR /&gt;&lt;A title="Shape Check, or finding self intersections of a spline" href="https://maxscriptbook.com/community/maxscript/Shape+Check%2C+or+finding+self+intersections+of+a+spline/" target="_blank" rel="noopener"&gt;https://maxscriptbook.com/community/maxscript/Shape+Check%2C+or+finding+self+intersections+of+a+spline/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;several functions from Spline3d class seems to work except for&amp;nbsp;&lt;SPAN&gt;SurroundsPoint(Point2 p)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I can't find any reference to read about using this from maxscript, so I really appreciate any clue about what should I look at&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 15:50:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13222604#M239</guid>
      <dc:creator>gastonDTKNS</dc:creator>
      <dc:date>2024-12-20T15:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to call SurroundsPoint(Point2 p) API function from maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13222768#M240</link>
      <description>&lt;P&gt;OK, it looks like the .shape_ property is only available for some shape types. I found another forum thread on a similar topic:&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/3ds-max-programming/spline-normalize-2-extend-modifier-how-can-i-snapshot-as-spline/m-p/12833562/highlight/true#M32309" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/3ds-max-programming/spline-normalize-2-extend-modifier-how-can-i-snapshot-as-spline/m-p/12833562/highlight/true#M32309&lt;/A&gt;&amp;nbsp;where Denis shows how to use MakeBezier to get the shape for a Line object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With that, I was able to get your SurroundsPoint call working:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;-- create a new Point2 value with coordinates [1,2]
p = g.point2.create 1 2
-- shp is the current spline
shp.SurroundsPoint p&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know whether this actually does what you need, but at least it now returns "false" instead of an error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 17:27:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13222768#M240</guid>
      <dc:creator>MartinBeh</dc:creator>
      <dc:date>2024-12-20T17:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to call SurroundsPoint(Point2 p) API function from maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13223011#M241</link>
      <description>&lt;P&gt;Great!!! that was the answer, you defined the point2 value inside the GlobalInterface instance, it is working in both cases, thanks a lot!&lt;/P&gt;&lt;P&gt;It is for nothing specific right now, I'm just trying to understand the concept of using the interface&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(
  g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
  inode = g.coreinterface7.getinodebyhandle $.inode.handle
  shp = ((inode.EvalWorldState (int currenttime) true).obj).shape_
  splines = for i=0 to shp.SplineCount-1 collect shp.GetSpline i
  
  p = g.point2.create 0 0
  
  for i=1 to splines.count do
  (
    format "isClockWise %\n" (splines[i].isClockWise)
    format "matID %\n" (splines[i].getMatID 1 )
    --without parameters the function is recognized
    format "SurroundsPoint %\n" ( splines[i].SurroundsPoint )
    --THIS GIVES AN ERROR
    --format "SurroundsPoint %\n" ( splines[i].SurroundsPoint [0,0] )
	
	--SOLUTION, the point2 is defined inside the instance instead of passing it from maxscript
	format "SurroundsPoint %\n" ( splines[i].SurroundsPoint p )
	
    format "Spline % is self-intersecting: %\n" i (splines[i].SelfIntersects)
    for j=i+1 to splines.count where splines[i].IntersectsSpline splines[j] do
    (
      format "Spline % intersects spline %\n" i j
    )
  )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Another doubt I have is if I should free those variables or maxscript does that automatically when they are inside a certain scope&lt;/P&gt;&lt;P&gt;Thanks again for your help&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 20:26:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13223011#M241</guid>
      <dc:creator>gastonDTKNS</dc:creator>
      <dc:date>2024-12-20T20:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to call SurroundsPoint(Point2 p) API function from maxscript</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13223972#M242</link>
      <description>&lt;P&gt;My expectation would be that both MAXScript and dotNet do their own garbage collection, so I don't think one has to "free" the variables. I might be wrong, though...&lt;/P&gt;</description>
      <pubDate>Sat, 21 Dec 2024 12:00:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/how-to-call-surroundspoint-point2-p-api-function-from-maxscript/m-p/13223972#M242</guid>
      <dc:creator>MartinBeh</dc:creator>
      <dc:date>2024-12-21T12:00:47Z</dc:date>
    </item>
  </channel>
</rss>

