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.

New Custom Feature: Publish Geometry

joshtargojoshtargo Member Posts: 316 EDU

Directly inspired (copied) from @GregBrown's great Top Down video, I wrote my own version of Publish Geometry, which allows you to make Composite Parts that can include Bodies, Faces, Sketch regions, Curves, and Mate Connectors.

One Derive can bring in all of this stuff as a single Composite Part to use as reference geometry for further design work.

I think the script is ok, but let me know if you find bugs.

Comments

  • S1monS1mon Member Posts: 3,155 PRO

    I was excited to see @GregBrown 's video, and decades ago I remember appreciating Creo (then Pro/E) using the Publish/Subscribe model. It made a fair amount of sense to me then, and I missed it when I moved to Solidworks.

    Now that this is in the context of Onshape, I question the functionality a bit. It makes a lot of sense if there are multiple dependent part studios, as it makes it much easier to modify the available references in one place (the publish feature). However, if the path of dependencies is just one master part studio to a dependent part studio, then perhaps it would be better to have a more capable derive feature which would allow all the available reference types and make it a little easier to see what's been picked. Right now the derive feature brings up a very tiny window with small previews and if you don't have sketches named, it's really hard to tell what you're picking.

    I also find the UX of turning on and off visibility of the sub-items in a derive to be tricky. I sometimes end up toggling things on and off more than I really need to because there are layers of states which control what's visible. I haven't tried this Publish feature yet, but I'm curious how this one (or Greg's) affects the visibility toggling if everything is bundled in a composite item.

    I miss Solidworks concept of "favorites" which allows key sketches etc. to be collected at the top of the tree for quick location and visibility toggling.

    I think there's room for both approaches, but I'd really like to see more improvements to the built-in derive.

  • rob_mcmahonrob_mcmahon Member Posts: 3

    thanks for this - looks good. I do get an 'error - can not resolve entities' unless I select at least one entity for each of the boxes (body, curve, face, mate connector) - is that intended functionality?

  • joshtargojoshtargo Member Posts: 316 EDU

    @rob_mcmahon I fixed it (i think) thanks for finding the bug. update to the next version.

  • nick_papageorge_dayjobnick_papageorge_dayjob Member, csevp Posts: 868 PRO

    I used publish geom all the time in Proe/Creo. I liked that it well organized what you were sending from a skeleton model to a subsequent model.

  • romeograhamromeograham Member, csevp Posts: 689 PRO

    Super-useful. After watching the video by @GregBrown I can really see how this workflow would make our derived work methods sooo much more robust. As far as I can tell, the special sauce that's needed to make this work is the fact that Mate Connectors can't be used in a Composite part - but I guess if they're owned by a body they can work OK. I'd also like to be able to use Planes in the Publish feature.

    Trying out your Publish feature - I'd like Mate Connectors (and all elements, really) be usable in more than one Publish feature. That way we could create a Mate Connector for the full assembly coordinate system, and include that MC in each of the Publish features.

    Right now, the functionality seems to consume Mate connectors. It allows bodies to be used in more than one Publish features, but not MCs.

    Also - it would be amazing if the MCs in the composite part kept the name of the source MCs too!

    Nice work!

  • rob_mcmahonrob_mcmahon Member Posts: 3

    thanks @joshtargo !!

    @romeograham - if you remove this bit it should stop consuming the MC's

            opDeleteBodies(context, id + "deleteBodies1", {
                    "entities" : definition.mc
    

    regarding the naming of MC's - I was hoping for the same thing but couldn't get it to work. It seems that Onshape doesn't let you get a feature name in featurescript - I think because renaming a feature doesn't trigger a rebuild so there is no way to catch if it has changed.

  • joshtargojoshtargo Member Posts: 316 EDU

    @rob_mcmahon I changed the FS to not kill the mate (i was trying to reduce duplicates), and you can use get and set property in edit logic, but not for mate connectors.

  • romeograhamromeograham Member, csevp Posts: 689 PRO

    Thanks @rob_mcmahon . When I remove (delete or comment out) sections like that

    an error appears at the top of the FeatureStudio, and you can see the errors in the monitor panel below:

    Any idea how to correctly remove bits of the FeatureScript code?

    Thanks!

  • romeograhamromeograham Member, csevp Posts: 689 PRO

    Also, @joshtargo not seeing an updated version yet - document is still on V2 as far as I can tell.

  • joshtargojoshtargo Member Posts: 316 EDU

    @romeograham sorry, just saved v3 which now doesn't delete any of the selected mate connectors.

  • romeograhamromeograham Member, csevp Posts: 689 PRO

    @joshtargo Great! Now it's working as I'd hope, and we can start to play with the great Publish Workflow as @GregBrown has laid out in his most recent video:

    While we see if Onshape is going to implement some native workflows in 2025!

    Thanks Josh for your quick work and for creating this FS for us to mess around with.

    Romeo

  • chadstoltzfuschadstoltzfus Member, Developers, csevp Posts: 150 PRO

    All this was btw was you needed to comment out the }); on that bottom line. FS was just throwing a syntax error since those are the closing brace and semi colon belonging to that opDeleteBodies function.

    Applications Developer at Premier Custom Built
    chadstoltzfus@premiercb.com
  • EvanReeseEvanReese Member, Mentor Posts: 2,235 ✭✭✭✭✭

    Thanks so much, @joshtargo! I'm definitely on board for this kind of workflow and I'll try it out.

    @S1mon re: "favorites" folder. I agree this was something I used to use. These days I'll often add an odd character to my "favorites" and use the search bar. It can be handy by way of having multiple separate lists if you care. For example use "." for some things and "~" for some things.

    Evan Reese
  • nick_papageorge_dayjobnick_papageorge_dayjob Member, csevp Posts: 868 PRO

    Hi, I went to use this today, and it does not allow intersecting lines in a sketch to be part of the pub geom, even if the line is a construction line. Can this be updated? Thanks.

    I'm trying it out to add the panel cutout for an hdmi connector, rather than use the in-context asm way.

  • nick_papageorge_dayjobnick_papageorge_dayjob Member, csevp Posts: 868 PRO

    Also, once the derive on the subsequent model occurs, the sketch entities turn into curves. I can't select them directly to do anything with them, such as an extrude. I have to make a new sketch, where I "use-edge" of the curves. Those new sketch entities I can then extrude. Is there a way to use the imported entities directly, avoiding the extra step?

    ,

  • joshtargojoshtargo Member Posts: 316 EDU

    I think the issue stems from the actual Composite Curve feature, which can not allow crossed lines. I'll try to think of a way around it.

  • EvanReeseEvanReese Member, Mentor Posts: 2,235 ✭✭✭✭✭

    Am I wrong to think that you don't need composite curves and can just use composite parts for it all?

    Evan Reese
  • romeograhamromeograham Member, csevp Posts: 689 PRO

    @GregBrown 's Publish version in his YouTube allows selecting sketches directly - and they persist as sketches in the derived feature. Anyone know how that can be enabled?

  • joshtargojoshtargo Member Posts: 316 EDU
  • EvanReeseEvanReese Member, Mentor Posts: 2,235 ✭✭✭✭✭

    Hmm I did a test and you seem right, so I'm not sure how to do it.

    @GregBrown I'm sure you've been asked about sharing this and other features you've shown on your channel. Thoughts?

    Evan Reese
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,054 ✭✭✭✭✭

    @joshtargo

    opCreateCompositePart seems happy to just take in any of the bodies created by a sketch (and the composite part then includes the whole sketch).

    The only limitation here is that it can't be a closed part.

    Example (see the compose feature which is just a wrapper):

    FSTest | Part Studio 1

    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
Sign In or Register to comment.