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.

How to query "self-referencing" entities that are generated in the feature

Jose_MoralesJose_Morales Member Posts: 15 PRO
Hi there,

This is a bit of a weird one. I want to be able to have the user give an initial set of inputs, have a script that uses those to generate some sketches and bodies, and then (still in the UI screen) for the user to be able to fill out a Feature Parameter Query with one of the entities created from the feature. 

In this case I want the user to drop select a file from which a lot of geometry is generated, then be able to select one of the vertices, which will then feed the script to continue generating the rest of the geometry.



I understand why just adding the query request in the preconditions doesn't work, but I'm hoping there's some way to do this.I tried creating another Feature just after the first one but that doesn't seem to work. 

Thanks in advance for any help.

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,884
    Sorry, it can’t be done. The feature must regenerate in its entirety so no intermediate selections are possible. The only way you can do this is to create a second feature and have a two-step process. 
  • Jose_MoralesJose_Morales Member Posts: 15 PRO
    edited February 19
    @NeilCooke

    Yeah, I suspected as much. That kinda makes it messy (and I don't even know that it'd work with what I want to do).

     Is there at least a way to have both Features be prompted by a single UI? Like someway of taking 2 features and merging their UI screens into 1.
  • MBartlett21MBartlett21 Member Posts: 1,773 EDU
    @Jose_Morales
    You could try using a manipulator (Look at manipulator.fs)
    MB - I make FeatureScripts:View FeatureScripts
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,884
    @Jose_Morales - no, it is only one UI per feature type. If it is point/vertex selection, you could try the point manipulator like @MBartlett21 suggests, but it may get a little crazy visually is there are a lot of points.
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    edited February 20
    There is a similar discussion going on in a wire looming thread. 
    In an ideal world I'd like a FS that first brings in an instance of the connector we require, and then allows the user to click on the pins of that connector to chose pinouts and wire colo(u)rs.  We can't do that of course because because these connectors don't exist at the time the precondition is executed. :s
    Same deal with making one or more composite parts of the results.
    So today it's looking like a sequence of 3 different FeatureScripts to get the order of operations as we need.  I can live with that. :+1:
    Being able to have a multi stage feature each with it's own precondition would be awesome though.
    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • Jose_MoralesJose_Morales Member Posts: 15 PRO
    Thanks, @NeilCooke and @MBartlett21 . I'm gonna look into manipulators, but I've been designing the FS work flow for the tool and I think it might not be too terrible to have it be 2 features; we'll see.
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Thanks for the down-vote to whoever did that. Mind telling me why?
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • Jose_MoralesJose_Morales Member Posts: 15 PRO
    Whoops, that was me. I meant to upvote. I'm used to Reddit where upvote is on the left.
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Ah, no problem at all, was worried I'd said something that upset somebody! Cheers, Owen.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • MBartlett21MBartlett21 Member Posts: 1,773 EDU
    @owen_sparks
    If you want an example of a points manipulator you can look at my beams feature
    See line 150 here: https://cad.onshape.com/documents/cfcc264d41817d876589755c/w/96f5dc1940f48d057e52bdaa/e/404f7326c439894ea55e4ff6

    MB - I make FeatureScripts:View FeatureScripts
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    @owen_sparks
    If you want an example of a points manipulator you can look at my beams feature
    See line 150 here: https://cad.onshape.com/documents/cfcc264d41817d876589755c/w/96f5dc1940f48d057e52bdaa/e/404f7326c439894ea55e4ff6

    Wow, there's a lot going on in that document :+1:
    That manipulator does seem to open up some possibilities. Thanks for sharing it
    Cheers, Owen S. 

    Business Systems and Configuration Controller
    HWM-Water Ltd
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,531
    @Jose_Morales @owen_sparks

    It is possible to have a multi-stage feature in a single dialog.  You just create an enum for the phases and make it the first input of the feature.  If you give it the HORIZONTAL_ENUM UIHint, it will appear as tabs instead of a dropdown.  Then branch with an if and define the look of both phases, and in the feature body have a global branch that does two completely different things based on which phase was selected.  I put together an example of this:
    https://cad.onshape.com/documents/0c06537195bf449a5f21f945/w/700cf90d6fe7e822a4e1e307/e/824cc77612191cc612145140

    @kevin_o_toole_1 and I had a chat about it as well, and the major UX concern here is that a user will see "phase 2" at the top and just fill in phase 1 and click on phase 2 to move along, then all their stuff will disappear because what they were actually supposed to do was commit the feature, and use a second feature for phase 2.

    The best solution we came up with for this was an "auophasing" feature which has a READ_ONLY phase and uses editing logic in combination with a variable on the context to set the phase of the feature appropriately as it is being created.  This turned out to be really slick in combination with the Shift+Enter shortcut, which will seamlessly move you into the next phase.

    In my example I have provided both a simple phased feature, and a more advanced autophased feature.

    Let me know if you have any questions!
    Jake Rosenfeld - Modeling Team
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    @Jake_Rosenfeld
    I am very much looking forward to diving into that and really appreciate you folks putting in the effort to raise examples for us 👍
    I've finished work for the day and am tucked up in bed with man snivels but I'm positive I'll be back with some questions on Monday.
    Thank you,
    Owen.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • Jose_MoralesJose_Morales Member Posts: 15 PRO
    @Jake_Rosenfeld

    This sounds really cool. I was gonna dig into it but the link you provided is throwing an error:

    "Failed to load document for workspace. Resource does not exist, or you do not have permission to access it".
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,531
    @Jose_Morales

    Thanks, I forgot to make it public.  Should be good now.
    Jake Rosenfeld - Modeling Team
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    @Jose_Morales

    Thanks, I forgot to make it public.  Should be good now.
    Link is all good now.

    Nice features and that Auto-phase method is indeed very slick.  :) I'll have a play later and see if I can bend it to my will.  (Have method 1 sussed but need to work out how you've achieved the latter.)

    I was hoping that one day this sort of functionality might be introduced, to have a chunk of it already there exceeds the expectation.  Good stuff Devs :+1:
    Cheers folks,
    Owen S.

    Business Systems and Configuration Controller
    HWM-Water Ltd
  • MBartlett21MBartlett21 Member Posts: 1,773 EDU
    edited March 10
    @owen_sparks
    If you want an example of a points manipulator you can look at my beams feature
    See line 150 here: https://cad.onshape.com/documents/cfcc264d41817d876589755c/w/96f5dc1940f48d057e52bdaa/e/404f7326c439894ea55e4ff6

    Wow, there's a lot going on in that document :+1:
    That manipulator does seem to open up some possibilities. Thanks for sharing it
    Cheers, Owen S. 

    @owen_sparks
    That document is a beams feature that is based on @NeilCooke 's feature, but it has very different internal workings and is split into a lot of feature studios, rather than in one huge one (currently 15).
    I also have added a few other features to it, such as weld gaps, customisable profiles, custom properties, cutlists and custom profiles complete with part number, material and maximum length
    MB - I make FeatureScripts:View FeatureScripts
  • Jacob_CorderJacob_Corder Member Posts: 11 PRO
    @Jake_Rosenfeld
    That's a pretty slick idea. I shall steal it shamelessly. 
    😄😄
Sign In or Register to comment.