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.

Named Surfaces

BStumpBStump Member Posts: 19 ✭✭
edited December 2022 in General
I need a way to name surfaces or use the surface metadata ID to share with an external CFD application when exporting parasolid models.  Is this possible?

Answers

  • MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO
    edited December 2022

    Yes. You can do this with FeatureScript:

    See this example: Setting & getting face property

    setProperty(context, {
         "entities" : definition.face,
         "propertyType" : PropertyType.NAME,
         "value" : DebugColor[toString(definition.color)]
         });

    In case you ever need something similar, setAttribute() works very well. Though it is only for Onshape to Onshape, it will not stay with the part during export.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • BStumpBStump Member Posts: 19 ✭✭
    But can you rename a face, and in doing so can you export the name in the parasolid file?
  • MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO
    edited December 2022

    Definitely. See the import tab, it shows that the face that was named in the original tab, stayed with the parasolid part even after download and re-upload. 


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • BStumpBStump Member Posts: 19 ✭✭
    I does look like this is possible.  We will be testing some OnShape Parasolid files tomorrow in the high-end CFD to see if the named surfaces show up.
  • Jed_YeiserJed_Yeiser Member Posts: 37 PRO
    Hey there - this thread seemed like the closest 'match' to the issue I'm having. If anyone can share some light on what I'm doing incorrectly, I'd appreciate it!

    I'm working on a FS that sets up a number of planes (as well as moves some solid bodies around) to act as trimming geometry further down the model tree. The number of planes created depends on user input, though each plane should have a unique name that is assigned in the FS. In other words, if the user selections lead logic to create a given plane, it should always be called 'Special Name Plane'. 

    I'm creating the planes with opPlane calls and setting the name with setProperty calls:

    opPlane(context, id + "FCP3DPlane", {
                    "plane" : plane(fcp3DLine.origin, fcp3DLine.direction),
                    "width" : 100*millimeter,
                    "height" : 100*millimeter
            });
            
        
            setProperty(context, {
                    "entities" : qCreatedBy(id + "FCP3DPlane", EntityType.FACE),
                    "propertyType" : PropertyType.NAME,
                    "value" : "3D FCP Plane"
            });

    however, the planes that show up in the feature tree are simply called 'Plane #'.  Basically - the setProperty call does not seem to be working. 

    What am I missing here?

    Thanks!


  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    @Jed_Yeiser setProperty is for properties of a part. It's not possible to name planes through FS, Can you create an improvement request in the category on the right ==> ?
    Senior Director, Technical Services, EMEAI
  • MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO
    edited January 22

    @Jed_Yeiser, SetAttribute() may be of use to you. Then you could check all previous planes for their "names" via attributes, then create your new one based on the previous "names".

    https://cad.onshape.com/documents/bdc2ba2f0442948f980c2dbd/w/b8075d373e20aaa5f1c34512/e/6f7a8...




    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • Jed_YeiserJed_Yeiser Member Posts: 37 PRO
    Thanks, @MichaelPascoe! I'll play around with the FS you provided and dig into the docs to further my understanding between Properties and Attributes. I've also submitted an IR per @NeilCooke's suggestion. Because FS (... and OS, for that matter) is pretty new to me, I've been playing around with some code that lets me create similar reference geometry as a surface, plane and mate connector. I'm able to name the Surfaces, but not the planes or mate connectors - I'm guessing this is because a mate connector isn't a part, so setProperty won't work. I've found one forum where a user suggests using setProperty to name a mate connector, but found no examples of it actually working. 

    I suspect that as I become more familiar with OS and FS, I'll get to the point where I find a better way to accomplish what I want - until then, it's off to the docs. Thanks!

  • MichaelPascoeMichaelPascoe Member Posts: 1,982 PRO

    @Jed_Yeiser legit. Feel free to post on the forums, lots of helpful people here. It's where I learned FS. There are some really neat things you can do using FS and or the API, the possibilities are almost endless depending on your knowledge and time you are willing to spend setting up.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
Sign In or Register to comment.