Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
opTransform returns error ILLEGAL_MODIFICATION
lemon1324
Member, Developers Posts: 225 EDU
So I was trying to use the Auto Layout feature in an assemble->in-context->copy-in-place->operations workflow like that demonstrated on this top-down weldment, but the feature was not packing my mostly-rectangular parts anywhere near optimally. Looking at the resulting layout, it looked like what would happen if somehow the bounding box was being calculated incorrectly (by significant margins). According to the bounding box documentation, if tight is not specified, it should default to true, though, so I tried to debug and see what the computed bounding box actually was.
To debug on the same geometry I moved that in-context derived tab into my copy of the auto-layout feature script, but now attempting to opTransform any of the bodies throws an ILLEGAL_MODIFICATION error, which I can't find further documentation on. I can, however, manually insert a transform feature and transform the exact same part. For testing, I've commented out everything except a debug and the opTransform.
Questions:
To debug on the same geometry I moved that in-context derived tab into my copy of the auto-layout feature script, but now attempting to opTransform any of the bodies throws an ILLEGAL_MODIFICATION error, which I can't find further documentation on. I can, however, manually insert a transform feature and transform the exact same part. For testing, I've commented out everything except a debug and the opTransform.
Questions:
- What is an ILLEGAL_MODIFICATION error?
- What could cause a difference between doing an opTransform in FS and manually inserting a transform feature?
- Does it matter that the in-context relation is broken by moving it to a new document? (The odd behavior from the unmodified Auto Layout still remains, so I don't know if that's it)
- I attempted to change FS version from 275 to 765. This seems to have broken something, though trying the minimal "select the first body and transform it up by 5 inches" doesn't seem to be working in 275 either. No errors, but the body hasn't moved. There's a lot of changes between these, but would any of them result in this behavior?
Arul Suresh
PhD, Mechanical Engineering, Stanford University
PhD, Mechanical Engineering, Stanford University
0
Comments
The illegal modification you're seeing is a restriction we place on in context parts. If you notice during manual editing of in-context part studios, you can't actually modify the ghosted in-context parts. For example, if you try to do a transform without "Copy part" checked you have a similar problem:
The reason this isn't an ILLEGAL_MODIFICATION is that the transform feature catches these parts early and throws an error if "copy part" is not checked. You can see this in action around line 297 of the `fTransform` feature:
https://cad.onshape.com/documents/12312312345abcabcabcdeff/w/a855e4161c814f2e9ab3698a/e/81869edac6224be29410b2a3
If you DO have the "Copy part" option checked, the transform feature actually uses opPattern instead of opTransform to create a transformed copy in the desired location.
SO, how does this affect you? You could use `fTransform` instead of `opTransform` and specify the `makeCopy` option, but the `fTransform` feature does not take raw transforms so that may not be a great option. You'll probably want to do something like this:
and then use opTransform on the modifiableEntities and opPattern on the nonModifiableEntities.
As for your last question, it's probably best to bring your copy of the feature up to current while you do this if possible. There have been a lot of bug fixes since December 2015 . Fun fact: V275 is when we came out of Beta.
Hopefully I've answered all 4 of your questions.
Adding the filter fixed everything, and also explains why those specific errors happened--modifiableEntities wasn't in 275, which is why it was failing silently, and obviously when doing it manually, I was clicking on the visible, modifiable part, which worked.
PhD, Mechanical Engineering, Stanford University