Notifications
Clear all

[Closed] getAreaByNode – Wrong function being called

Hi

I want this function to be called
from the docs

<void><Unwrap_UVW>.getAreaByNode <bitArray>faceSelection <&float>x <&float>y <&float>width <&float>height <node>node 

so i get the min max etc… so i can get a 2d bounding box from the selected faces

BUT max always calls this one

<void><Unwrap_UVW>.getAreaByNode <bitArray>faceSelection <&float>areaUVW <&float>areaGeom <node>node 

which has the same name so i get an arg count error, i can only imaging is a typo so does anyone know what the actually name of the first function is with 6 args

Cheers
Dave

5 Replies
 lo1

It’s not a docs typo, the interface really is defined that way:

showinterfaces (unwrap_UVW())

...
 <void>getAreaByNode <bitArray>faceSelection <&float>areaUVW <&float>areaGeom <node>node
       areaUVW is Out parameter
       areaGeom is Out parameter
    <void>getAreaByNode <bitArray>faceSelection <&float>x <&float>y <&float>width <&float>height <node>node
       x is Out parameter
       y is Out parameter
       width is Out parameter
       height is Out parameter

...

As far as I remember you can’t overload functions in an FPInterface, which makes me raise an eyebrow at whoever developed this interface, but I’d love to be proved wrong…

Doesn’t seem to be intentional as it gives you bounds and not area anyway:

unwrap_getareaByNode, _T("getAreaByNode"), 0, TYPE_VOID, 0, 4, ...
  unwrap_getboundsByNode, _T("getAreaByNode"), 0, TYPE_VOID, 0, 6, ...

Thought it might be a nice thing to test the new Python API on – and I failed miserably, maybe someone else has a better idea:

import MaxPlus, sys
  
  unwrap6 = MaxPlus.Core.EvalMAXScript('$.unwrapUVW.unwrap6').Get()
  unwrap6.FindFn('getAreaByNode') # well, it might be the next one but... without FPParams it's useless
 
  # only works for parameterless functions, like load:
  # MaxPlus.Core.EvalMAXScript('$.unwrapUVW.unwrap').Get().Invoke(2)

Im guessing your meaning the FPInterface class in the SDK? I have not used the SDK so I assume. If this is not overloadable how would this even occur?

Nice idea with the python but unfortunately im still using 2013 an dont have Python installed in Max.

I guess as usual its back to writing a custom function of something that should work…frustrating as its going to slow down the script manually calculating the min/max of verts
:hmm:

Cheers for the thoughts
Dave

1 Reply
(@denist)
Joined: 2 years ago

Posts: 0

it has not to be very slow. my simple test says that to calculate 2D bbox takes 0.5 sec for 500,000 verts. not bad… hopefully you don’t need it for real-time…

sure ok Dennis it may not be slow in terms of a large script running but it cant be faster than an inbuilt cpp function call and its something that should just work from autodesk in the first palce

Dave