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.

Options

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

  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,717 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!   cadsharp.com/featurescripts 💎
  • Options
    BStumpBStump Member Posts: 19 ✭✭
    But can you rename a face, and in doing so can you export the name in the parasolid file?
  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,717 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!   cadsharp.com/featurescripts 💎
  • Options
    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.
  • Options
    Jed_YeiserJed_Yeiser Member Posts: 11
    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!


  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,399
    @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
  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,717 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!   cadsharp.com/featurescripts 💎
  • Options
    Jed_YeiserJed_Yeiser Member Posts: 11
    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!

  • Options
    MichaelPascoeMichaelPascoe Member Posts: 1,717 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!   cadsharp.com/featurescripts 💎
Sign In or Register to comment.