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.

Advanced Non-Uniform Scale Feature

leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
edited April 2017 in FeatureScript
Here and there I've seen threads or posts about the need for a non-uniform scale feature.
I've written a little feature in FeatureScript capable of scaling in any chosen direction or set of directions.

Choice between:
  1. Uniform scaling; in the standard coordinate system
  2. Non-uniform scaling; in the standard coordinate system
  3. Scaling in one direction; one direction query, one scale factor query
  4. Scaling in three directions; one or two direction queries (second will default perpendicular to the first until queried),
    the third direction will be perpendicular to both, one scale factor query for each direction
Options:
  • Keep Tools Boolean for keeping the original bodies and scaling a copy
  • Use Entity Centre Boolean for using the calculated centroid (centre of surrounding box) or
  • Feature Type choice between Feature or Entity queries. Not entirely sure whether Feature Scale works as it should.
    So far it seems to work with bodies, faces, wires, and points (for the latter two you'll need to specify a reference point)
Some screenshots:

It's far from perfect, the script has quite some clutter, i'm sure I have taken some detours and is has too many if/else statements.
But if you find it useful: have a copy, or import it to your collection of FS features. If you have any input for me, or tips and tricks on how to improve; all the better, do let me know!

https://cad.onshape.com/documents/c3f3651d28491d28eefba7d3/v/167ba220d329f5bec671e716/e/dbc28ecb5a20b4bfa14fc748

Cheers /Leon

Edit updated screenshots, info and version link
"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless

Comments

  • Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭✭
    This is amazing! Great work Leon.
    There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
    edited April 2017
    Thanks @Lee_Hesketh

    I just pieced together a bunch of small little things I had together with some bits from the forum, turned out alright it seems.
    It works on points and wires, and sketches as well when using Feature Scale (forgot to put that in the version above).

    I'll see if I can update the post sometime with screenshots and more info when I have the time for it / if necessary, though I believe the UI is fairly straight-forward. done
    "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    hi, @leon_poot, i'm requesting ability to scale entity according to some local coordinate system (defined by mate connector)
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
    That's a smart idea, @konstantin_shiriazdanov. I'll have a look once I have a little time to spare! 
    "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
    edited August 2017
    "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    thanks a lot @leon_poot, never too late)
  • Cache_River_MillCache_River_Mill Member Posts: 225 PRO
    Excellent! This is really nice. Tank you!
  • David_BoneDavid_Bone Member Posts: 47 ✭✭✭
    Awesome!
    This should really be a standard feature.
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
    Awesome!
    This should really be a standard feature.
    @David_Bone, best way to get Onshape's attention when it comes to requesting standard features would be to either enter an Improvement Request here on the forums, or vote for one that already describes what you want.

    This one for example:
    https://forum.onshape.com/discussion/5345/non-uniform-scale-tool-improvement-request
    "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    edited January 2018
    Our built-in variant of this is coming soon as part of the transform/copy feature.  Thanks for filling in the gap in the meantime, Leon!  And for those that prefer the custom feature's interface to what we ship, there's no reason to stop using Power Scale.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
    Excellent news Ilya. Glad I've been able to help some people out in the meantime.
    Will the built-in variant allow mate connectors as directional input? Gotta admit I tend to use local coordinate systems for just about anything in CAD:
    "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    Yes, it'll let you specify a mate connector.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    Is there a way to easily scale things in sketches without having to dimension it?
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • mahirmahir Member, Developers Posts: 1,308 ✭✭✭✭✭
    edited January 2018
    @mbartlett21, the transform sketch tool doesn't include scaling. However, there are a few workarounds. When you create a new sketch, the first dimension you add will scale the rest of the sketch in order to keep the same overall sketch profile.You can also use solid/surface bodies as construction tools, i.e. create an extrude, scale the extrude, then create a sketch that uses the scaled body's edges.
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    mahir said:
    @mbartlett21, the transform sketch tool doesn't include scaling. However, there are a few workarounds. When you create a new sketch, the first dimension you add will scale the rest of the sketch in order to keep the same overall sketch profile.You can also use solid/surface bodies as construction tools, i.e. create an extrude, scale the extrude, then create a sketch that uses the scaled body's edges.
    The only problem with that approach is you have to delete all your dimensions if you have already done the sketch, then start over.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • mahirmahir Member, Developers Posts: 1,308 ✭✭✭✭✭
    @mbartlett21, I'm going to sound like an OS employee, but what is your use case? Generally, in 20 years of using cad I haven't really needed the ability to scale a sketch.

    Another possible solution is to build in a scaling factor using variables. Create a number variable #x and set it equal to 1. When you create and dimension your sketch, add "*#x" to the end of all your dimensions (or "#x*" to the beginning). Now, if you change #x, you will be scaling your whole sketch.
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    The main reason is for bringing in dxfs that were scaled wrong when they were created
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • mahirmahir Member, Developers Posts: 1,308 ✭✭✭✭✭
    Since you're starting with dumb lines anyway, I'd go with my earlier suggestion to create a surface/solid body with your imported DXF sketch, scale that body, then extract its edges in a new sketch. You can then delete the construction body.
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    mahir said:
    Since you're starting with dumb lines anyway, I'd go with my earlier suggestion to create a surface/solid body with your imported DXF sketch, scale that body, then extract its edges in a new sketch. You can then delete the construction body.
    That's an elegant workflow, thanks for sharing it. :):)

    Cheers,

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    The worst thing about DXFs importing into Onshape is that the line endpoints are not coincident to one another.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • leon_pootleon_poot Member, Developers Posts: 87 ✭✭✭
    edited January 2018
    Power scale does actually scale entire sketches, if that helps. Either from it's centre or a queried point. Select the sketch as a feature (choose "Feature Scale" instead of "Entity Scale".

    Just remember to toggle "Keep tool" (yes, that's a bug.)
    "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools." - Douglas Adams, Mostly Harmless
  • joshtargojoshtargo Member Posts: 264 EDU
    @leon_poot, I am not so good at Featurescript, but I modified yours a little so you can choose to scale From a Point To a Point.  Can you implement this better than me?  It would also be great if you could select a Curve to scale and have the script generate a new scaled curve inside the Sketch.

    https://cad.onshape.com/documents/67cbb8f46b26b814e3c888d8/w/4e141b8447600e837be432a4/e/d6fa430585027cc3a96a11f6?renderMode=0&uiState=65db4de6c4c31561320a6e83
  • joshtargojoshtargo Member Posts: 264 EDU
    mahir said:
    @mbartlett21, I'm going to sound like an OS employee, but what is your use case? Generally, in 20 years of using cad I haven't really needed the ability to scale a sketch.

    Another possible solution is to build in a scaling factor using variables. Create a number variable #x and set it equal to 1. When you create and dimension your sketch, add "*#x" to the end of all your dimensions (or "#x*" to the beginning). Now, if you change #x, you will be scaling your whole sketch.
    In 5 years at Honda R&D, I used a tool like this about 100 times a day (ish).  it's is absolutely essential for Class-A type surface data.
Sign In or Register to comment.