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.

Reset part instance to default position in assembly

johan_van_ravenhorstjohan_van_ravenhorst Member Posts: 17 ✭✭
edited March 2019 in Using Onshape
Inserting a part in an assembly offers a "default positioning" as specified in [1]. This uses the orientation and position of the the part w.r.t. the part studio's coordinate system *as* the orientation and position of the part instance w.r.t. the assembly's coordinate system.

Is it possible to "reset" the position of a part instance in an assembly back to this default after editing?

Such a reset is useful if [edit: for example] all of the following conditions are met:
  1. a large number of parts has been created in a single part studio P (e.g. due to many dimensional inter-dependencies),
  2. in assembly A, these parts must keep the same position and orientation w.r.t. each other as defined in P using a "Group",
  3. in A, many part instances from P have mates with parts from part studios *other* than P,
  4. for some reason, many P-parts have moved away from their initial default position (e.g. due to unintended manual movement, propagated updates from edits in P, etc) [edit: also assume many arbitrary movements of the P-part instances w.r.t. to each other]
  5. it is too much work to use the triad manipulator (or [temporary] mates) to bring the many part instances to the desired relative position to be used for the Group.
Already tried
  • "Replace parts...": Does not work because it uses the "current" part position instead of the "default".
  • Ctrl-z: Already too late for that.
  • re-inserting parts using default positioning: This would require replacing many mates.
What's next
Please help. Maybe I am missing something, or this problem is the consequence of bad modeling habits (not uncommon for me), or maybe an improvement request can be based on this discussion.

[1] https://cad.onshape.com/help/Content/insertpartorassembly.htm?Highlight=assemblies


  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,025
    In the Part Studio you could create a mate connector at the origin with your part as the owner. Then in the assembly mate the mate connector to the assembly origin. 
  • johan_van_ravenhorstjohan_van_ravenhorst Member Posts: 17 ✭✭
    @NeilCooke: That works, also for scenarios where many part instances in the assembly have moved relative to each other with multiple arbitrary distances or rotations. However, this requires a relatively large amount of work compared to shift-selecting multiple part instances and subsequently clicking (hypothetically, something like) "reset to default position".

    Is this worth an improvement request?

    Thinking out loud: Could such functionality be added, using Featurescript? For each user-selected part instance in the assembly, the script can query the position and orientation in the part studio (in which the part was created) and copy those values to the position and orientation of the instance in the Assembly. So there would be no need to save the initial position and orientation of the part instance in the assembly.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,025
    The reality is that there is no such thing as a “default position”. An IR would be required but again, in reality, I don’t think it would get implemented any time soon. 

    FeatureScript is only for Part Studios. However if you fancy having a go at REST API, you can transform all your parts in one go. Good luck!
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    edited March 2019
    The FS could could add a mate connection for each body in the partstudio (at the origin) though couldn't it?
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,025
    @owen_sparks very true. Would still need to add mates in the assembly but at least half the job would be done. 
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    NeilCooke said:
    @owen_sparks very true. Would still need to add mates in the assembly but at least half the job would be done. 
    Would an easy win as an IR be an option to select one or mate connectors in an assembly or partstudio, right click, "send to origin"?

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • romeograhamromeograham Member Posts: 378 PRO
    The FS could could add a mate connection for each body in the partstudio (at the origin) though couldn't it?

    I would LOVE a FS like this. I create each one manually now, since I generally want all parts to be constrain-able in "default" position in the assembly...then I change / add / edit mates as necessary.
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,560
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,560
    edited March 2019
    Jake Rosenfeld - Modeling Team
  • brucebartlettbrucebartlett Member, OS Professional, Mentor Posts: 2,026 PRO
    I would love to be able RMB on a part and move it to the modeled position without the need for extra mate connectors and having to go back into a part studio which may already be a released component. @NeilCooke I get what you are saying about no default position but parts do have a modeled position which can be quite useful when working with rigid assemblies as well as many other scenarios. I regularly drop a parts studio, group and fix 1 part so it is locked in the modeled position in a base level assembly, this is super fast for rigid assembles but as more modeled in position parts are added you need to ensure parts have not moved from their modeled position and also maintaining original instances so upstream mates are not affected.   

    Rather than using a mate connector, I'll quite regularly use a dummy part which is re-inserted in the modeled position (default), fix it and fasten mate the existing out of position part to the dummy moving it back to the modeled position, then delete the dummy and the fasten mate and re-add a fix or group mate. A simple move part to modeled position(default position) would be much easier.

    Engineer ı Product Designer ı Onshape Consulting Partner
    Twitter: @onshapetricks  & @babart1977   
  • johan_van_ravenhorstjohan_van_ravenhorst Member Posts: 17 ✭✭
    @Jake_Rosenfeld: Yes, that FS alleviates the problem somewhat: Your FS makes sure that each inserted part instance carries a nice little "handle" (mate connector) that can be used to toss the part instance back to its "default position". Thanks for the fast implementation, [off-topic: FS kicks ass! I wish I could write code like that too, full-time, without feeling like watching television after a concussion after a few hours.]

    @brucebartlett: Nice workaround, thanks.
  • MBartlett21MBartlett21 Member Posts: 1,798 EDU
    Just wondering, should setExternalDisambiguation be done before a feature uses the id, or can it be done any time?
    In your FS, it has setExternalDisambiguation afterwards.
    MB - I make FeatureScripts:View FeatureScripts
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,560
    edited March 2019

    I've actually made a mistake here, thanks for pointing it out.  The intention of setExternalDisambiguation is to help in the historical processing of operations with an unstableIdComponent.  Since historical processing is the final step of the opXYZ(...) call, setting the external disambiguation after calling the operation will actually have no effect.  I've updated the script.

    I also just noticed that I never versioned the document.  Now it is versioned so that anyone can use the feature directly from the document, without making a copy.
    Jake Rosenfeld - Modeling Team
  • Evan_ReeseEvan_Reese Member Posts: 253 PRO
    Forgive me if I'm being dense here @NeilCooke , but isn't there a kind of "default position" when you insert a bunch of parts from a part studio? I mean, isn't that the whole idea behind the "Group" mate type? If they are already modeled in position, and there's no motion to simulate, then just group them. maybe instead of calling it "reset to default position" it could be thought of as matching origins between the Part Studio and Assembly. I agree that this would be really helpful, and shouldn't require the creation of a bunch of mate connectors to do it. I'd rather delete 5 parts and re-insert them to re-set their position and group them than make mate connectors and mate them all.
    Evan Reese / Agency Owner and Industrial Designer
    Website: fractalmade.com
    Instagram: @evan.reese.designs
  • romeograhamromeograham Member Posts: 378 PRO
    I somehow missed this when you tagged me in March. Just came across this FS now. Thanks for this!
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,560
    No problem :)
    Jake Rosenfeld - Modeling Team
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,410 PRO
    edited May 2019
    I've been grouping sub-assemblies, which in turn, forces the top levels to re-assemble properly. Instead of having a top level go back to the home position, force the components in the top-assembly to goto the correct position.

    There is no way to explain this easily.

    How can you add components to a sub-assembly and then have them appear correctly in a higher level assy? I think I'm doing this, but struggle explaining it.

    I have a group, that's suppressed, defined in a sub-assembly. The problem is when you add new components at this level, they don't appear in the top assembly correctly because you've moved that sub-assembly in the top assembly.

    To get around this,

    -I position all the components correctly in the sub-assembly
    -un-suppress a group thats used for this purpose and add all components to group. This causes all the mates in the sub-assy to error out, who cares it's only temporary.
    -go to the top level, and the sub-assy group forces everything together correctly. 
    -go back to the sub-assy and suppress the group, everything calms down.
    -go to the top level, parts are now in their correct position.

    I can do this quickly and find it's a great way to keep top level assemblies in-sync with lower level assemblies.

    I have yet figured out a way to explain it though, I suppose  you can tell from this post.

Sign In or Register to comment.