Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

API Sketch Geometry ID

Lucas_CrupiLucas_Crupi Member Posts: 2
When calling the /partsudios/d/{did}/{wvm}/{wvmid}/e/{eid}/features from the REST API, there are some geometry references in the form of three characters, eg. "geometryIds": ["JMF"]

I have been able to find the ID of edges using /partsudios/d/{did}/{wvm}/{wvmid}/e/{eid}/bodydetails however, when the referenced geometry is an entity within a sketch such as a line, I cannot seem to find the appropriate API call. 

Any help or resources are greatly appreciated.

Answers

  • alan_baljeualan_baljeu Member, User Group Leader Posts: 102 ✭✭
    I believe "entityId"  is what you need.  See fragment below.

      "features" : [ {
        "type" : 151,
        "typeName" : "BTMSketch",
        "message" : {
          "entities" : [ {
            "type" : 4,
            "typeName" : "BTMSketchCurve",
            "message" : {
              "geometry" : {
                "type" : 115,
                "typeName" : "BTCurveGeometryCircle",
                "message" : {
                  "radius" : 0.05423578839196134,
                  "xCenter" : -0.03895397484302521,
                  "yCenter" : -0.03339579701423645,
                  "xDir" : 1.0,
                  "yDir" : 0.0,
                  "clockwise" : false
                }
              },
              "centerId" : "pUzfMw2i2Kly.center",
              "internalIds" : [ ],
              "isConstruction" : false,
              "parameters" : [ ],
              "isFromSplineHandle" : false,
              "entityId" : "pUzfMw2i2Kly",
              "namespace" : "",
              "hasUserCode" : false,
              "nodeId" : "M3H5t/In4rdlnyQ+z"
            }
          }
    Creating knowledge-driven design automation software, for molds, etc.
    www.virtualmold.com

  • alan_baljeualan_baljeu Member, User Group Leader Posts: 102 ✭✭
    I see the problem here: Extrude features reference geometry by geometryIds, and while we can get these ids for bodies, there's no id presented for sketch elements.  So here's a feature definition:

    {
        "type" : 134,
        "typeName" : "BTMFeature",
        "message" : {
          "featureType" : "extrude",
          "featureId" : "FukfxxLNUGr2Ytg_0",
          "name" : "Extrude 1",
          "parameters" : [ {
                  ... 
               {
            "type" : 148,
            "typeName" : "BTMParameterQueryList",
            "message" : {
              "queries" : [ {
                "type" : 138,
                "typeName" : "BTMIndividualQuery",
                "message" : {
                  "geometryIds" : [ "JGC" ],
                  "hasUserCode" : false,
                  "nodeId" : "FhjpxqVvrJ9zlPM"
                }

    and the arc (or face?) JGC is defined in the program by sketch entity "pUzfMw2i2Kly", but there's nowhere in the API to identify this link.
    But if I construct an extrude using a body face as reference, that reference can be found in the bodydetails call.
    Creating knowledge-driven design automation software, for molds, etc.
    www.virtualmold.com

  • alan_baljeualan_baljeu Member, User Group Leader Posts: 102 ✭✭
    The documentation has the resolution, thought it's a bit weird:

    Feature List API | Onshape Developer Documentation (onshape-public.github.io)

    We ask Onshape to run a featurescript query, get the geometry ID as a result, and that there is your geometryId.


    Creating knowledge-driven design automation software, for molds, etc.
    www.virtualmold.com

Sign In or Register to comment.