Error "Used entity could not be matched in manufacturing tree" when trying to add a geometry to a 2DContour operation

Error "Used entity could not be matched in manufacturing tree" when trying to add a geometry to a 2DContour operation

Jorge_Jaramillo
Collaborator Collaborator
215 Views
2 Replies
Message 1 of 3

Error "Used entity could not be matched in manufacturing tree" when trying to add a geometry to a 2DContour operation

Jorge_Jaramillo
Collaborator
Collaborator

Hi,

 

I'm trying to automate the geometry update of a 2DContour operation by replacing the current geometry to a new set of edges. The setup's model is a Manufactoring Model that comes from a Nesting Study.

 

This is the snipped code when the error occurs:

contours_param = oper.parameters.itemByName(CONTOURS_PARAMETER)
if not contours_param:
    return((False, f"Parameter '{CONTOURS_PARAMETER}' not found in Operation '{oper_name}'"))
contours_param_value: adsk.cam.CadContours2dParameterValue = contours_param.value
curve_selections: adsk.cam.CurveSelections = contours_param_value.getCurveSelections()
app.log(f"before: {curve_selections.count=}")
curve_selections.clear()
app.log(f"after clear: {curve_selections.count=}")
for k,outer_edge in outer_medium_edges.items():
    chain_sel: adsk.cam.ChainSelection = curve_selections.createNewChainSelection()
    chain_sel.inputGeometry = [outer_edge[EDGE]]
    chain_sel.isOpen = True
    chain_sel.startExtensionLength = 0
    chain_sel.endExtensionLength = 0
app.log(f"before: {curve_selections.count=}")
contours_param_value.applyCurveSelections(curve_selections)

 

The error I'm getting in line "chain_sel.inputGeometry = [outer_edge[EDGE]]" is the following:

 

 before: curve_selections.count=4
 after clear: curve_selections.count=0
 Failed:

Traceback (most recent call last):

  File "C:\fusion/fusion_script/testings\_t38_discovery_setup_config.py", line 470, in set_geometry_to_operation

    chain_sel.inputGeometry = [outer_edge[EDGE]]

    ^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\Users/Usuario/AppData/Local/Autodesk/webdeploy/production/7627f627889be835182cfc345110c3c9f5bc9cc3/Api/Python/packages\adsk\cam.py", line 19697, in _set_inputGeometry

  return _cam.CurveSelection__set_inputGeometry(self, value)

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

RuntimeError: 3 : Used entity could not be matched in manufacturing tree.

 

I'd tried with proxies of the edges (with the occurrence every edge belongs in the model) without any success.

 

Any clue how to solve this issue?

How the edges need to be taken or translated in order to be allowed in the geometry of that operation?

The same operation made manually from the GUI works all right.

 

Regards,

Jorge Jaramillo

 

0 Likes
216 Views
2 Replies
Replies (2)
Message 2 of 3

Jorge_Jaramillo
Collaborator
Collaborator

Hi All,

 

Debugging the chain selection's data model I got the following information:

 oper.contours: oper.parameters.itemByName("contours").value.getCurveSelections().count=1
   0 <adsk.cam.ChainSelection; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::cam::ChainSelection > *' at 0x000002526AEE4900> >
     inputGeometry                  : <adsk.core.BaseVector; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::core::Base > > *' at 0x000002526AE2D7D0> >
     startExtensionLength           : -762.0
     endExtensionLength             : -762.0
     hasError/hasWarning            : False / False
     isOpen                         : True
     [iterable] len(cs.inputGeometry)=2
       <adsk.fusion.BRepEdge; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::fusion::BRepEdge > >::value_type *' at 0x000002526AE2D710> >
             length : 187.4519999999987
             entityToken : /v4BAAAARlJLZXkAH4sIAAAAAAAA/62Su4oVQRCGQzNfwQZDKahbd1cHRt4iAxPBxKWvYiYivoD5piY+hU+ypr6DgZkgiN199hw4ycKKMwP9T/VX/0/XDDp2OG+aKx0U237TVQnu0+vLV9/uPaPL/uXXnav7dyfBToIbqhlDE5BkHbQUD2mQh1o1chvUUk3TY5IcC/pSCBrJJEdKYM1kki0nomEx1e04xBhLArKIoG3ClhLB8A21+24++8VZ86KRApAog+bA069EQB8a1kHW4s4dTFJqTsAxpplrCZJJBOol1qSsXeVwxkcvPn/88ef5w68/fz9+8P2K9/mng+QSsHQGTF5Ayc+kgAGwjJxRhnixOQ/9Dy60yOyLJw4VENcErBiY9QGZspqvXdXGzVltzaaZgXBfM/QdsucMODRRG12jHr73nJATz24uOptX/q4S7kvkpPik6KjQ9h+zQ/+hKd2+6fhz3qYNXW9v+sX7Xt++6xctf8juiTMHdP2we+oWN+US17WXB0R2jY+b59TyPuPkbPvUMLm/DBhcr2ADAAA=
             startVertex : (3.8100009765626623, 3.174994873047055, 0.0)
             endVertex : (3.8100009765626055, 190.62699487304576, 0.0)
             assemblyContext : ROOF:2
             nativeObject : <adsk.fusion.BRepEdge; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::fusion::BRepEdge > >::value_type *' at 0x000002526C015290> >
             nativeObject -> entityToken : /v4BAAAARlJLZXkAH4sIAAAAAAAA/51QOwoCMRD1KNNLIJlJ1lhY+eksbGyXYLJiJyJexXt4EmvvYGEtiJPZD6zdOgnM4817b0I0IGg+hrupEXpGBmxmCphvrpfnZz27vd6L8eOOoqQCYnRko/eKMGllo0sqOAxKV3ZqYpXsxOZkyRj9lOzTIOssEJBD4GaZ5UvCGi1F1CHskGmR9hIlb/rDNB1uan9piE1DivtUntLucExlDOcAS/CgTHMRVpB1DDNouG0tIeGwHfZVObuno964M7DuC2US2W/pAQAA
       <adsk.fusion.BRepEdge; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::fusion::BRepEdge > >::value_type *' at 0x000002526C0176F0> >
             length : 187.4519999999987
             entityToken : /v4BAAAARlJLZXkAH4sIAAAAAAAA/62Su4oVQRCGQzNfwQZDKahbd1cHRt4iAxPBxKWvYiYivoD5piY+hU+ypr6DgZkgiN199hw4ycKKMwP9T/VX/0/XDDp2OG+aKx0U237TVQnu0+vLV9/uPaPL/uXXnav7dyfBToIbqhlDE5BkHbQUD2mQh1o1chvUUk3TY5IcC/pSCBrJJEdKYM1kki0nomEx1e04xBhLArKIoG3ClhLB8A21+24++8VZ86KRApAog+bA069EQB8a1kHW4s4dTFJqTsAxpplrCZJJBOol1qSsXeVwxkcvPn/88ef5w68/fz9+8P2K9/mng+QSsHQGTF5Ayc+kgAGwjJxRhnixOQ/9Dy60yOyLJw4VENcErBiY9QGZspqvXdXGzVltzaaZgXBfM/QdsucMODRRG12jHr73nJATz24uOptX/q4S7kvkpPik6KjQ9h+zQ/+hKd2+6fhz3qYNXW9v+sX7Xt++6xctf8juiTMHdP2we+oWN+US17WXB0R2jY+b59TyPuPkbPvUMLm/DBhcr2ADAAA=
             startVertex : (3.8100009765626623, 3.174994873047055, 0.0)
             endVertex : (3.8100009765626055, 190.62699487304576, 0.0)
             assemblyContext : ROOF:2
             nativeObject : <adsk.fusion.BRepEdge; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::fusion::BRepEdge > >::value_type *' at 0x000002526AA04B10> >
             nativeObject -> entityToken : /v4BAAAARlJLZXkAH4sIAAAAAAAA/51QOwoCMRD1KNNLIJlJ1lhY+eksbGyXYLJiJyJexXt4EmvvYGEtiJPZD6zdOgnM4817b0I0IGg+hrupEXpGBmxmCphvrpfnZz27vd6L8eOOoqQCYnRko/eKMGllo0sqOAxKV3ZqYpXsxOZkyRj9lOzTIOssEJBD4GaZ5UvCGi1F1CHskGmR9hIlb/rDNB1uan9piE1DivtUntLucExlDOcAS/CgTHMRVpB1DDNouG0tIeGwHfZVObuno964M7DuC2US2W/pAQAA

This is the configuration from the GUI I made to this test:

- A 2D-Contour operation

- A single chain selection on it

- A single edge in the chain selection

Jorge_Jaramillo_0-1755789016955.png

 

I can see in the data model for the chain selection that it contains TWO reference to the edge:

  len(chainSelection.inputGeometry) is equal to 2

and that the edge is proxy from the occurrence it belongs (ROOF:2).

 

Comparing the already defined chain selection with the one I want to add with the API, they are the same:

 x- outer_edge[EDGE]=<adsk.fusion.BRepEdge; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::fusion::BRepEdge > >::value_type *' at 0x000002526BFEDE00> >
     length : 187.4519999999987
     entityToken : /v4BAAAARlJLZXkAH4sIAAAAAAAA/51Qu04EMQz8FffIkmM7OW9BxaOjoKE9ZTcJokMI8Sv8x33J1fwDBTUSIsnerrQN0pFE8mg8M1ZMwED1ulrdjNgqcqCNCXB1//72+XN3efj6vr74OHJXSgCJY6AxM9LgBdV5RgsUkMYSI0kRLy2nKqMfveMwIdGOUG00NMsFo4tqfsqqVv6elZIXTWYonGtC8hmj54hUdHCpZN3p/AsFAfEMtWg1t/mdddSPyIp4RW5BZH0Pfeg/TMP5pmXl59gIcnrM+5c8PT3nfYqvEW7AAN3pMdxC01XYwIl7mCXSOV6aW1XL3uhk014NVfcLibEpjDYCAAA=
     startVertex : (3.8100009765626623, 3.174994873047055, 0.0)
     endVertex : (3.8100009765626055, 190.62699487304576, 0.0)
     assemblyContext : ROOF:2
     nativeObject : <adsk.fusion.BRepEdge; proxy of <Swig Object of type 'std::vector< adsk::core::Ptr< adsk::fusion::BRepEdge > >::value_type *' at 0x000002526BFEF660> >
     nativeObject -> entityToken : /v4BAAAARlJLZXkAH4sIAAAAAAAA/51QOwoCMRD1KNNLIJlJ1lhY+eksbGyXYLJiJyJexXt4EmvvYGEtiJPZD6zdOgnM4817b0I0IGg+hrupEXpGBmxmCphvrpfnZz27vd6L8eOOoqQCYnRko/eKMGllo0sqOAxKV3ZqYpXsxOZkyRj9lOzTIOssEJBD4GaZ5UvCGi1F1CHskGmR9hIlb/rDNB1uan9piE1DivtUntLucExlDOcAS/CgTHMRVpB1DDNouG0tIeGwHfZVObuno964M7DuC2US2W/pAQAA

 

 

Both point to the same edge in the data model, both are a proxy, and also comparing their entityToken I can confirm it is the same object referenced.

 

Other tests I made with API code were:

- a design which does NOT contain a Manufacturing Model

- a design with a manually created Manufacturing Model which references the model (notice there were created 4 chain selections of 1 edge each), as shown in the following image:

Jorge_Jaramillo_1-1755791756411.png

 

So, how can I add a chain selection to 2D-Contour operation which setup is defined over a Manufacturing Model which contain a Nesting Study?

 

Regards,

Jorge Jaramillo

 

0 Likes
Message 3 of 3

Jorge_Jaramillo
Collaborator
Collaborator

Hi All,

 

I'm stuck developing this AddIn.

 

I'm lost since I'm following the instructions provided in the Manufacturing API documentation (https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-A08218F6-3885-4677-9CAD-7234BCEE85CC) especially in the section "CadContours2dParameterValue".  I don't know what else to check or change.

 

PLEASE YOUR HELP!!!!

 

Regards,

Jorge Jaramillo

 

0 Likes