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.

FeatureScript request: Auto adjust planes to max size of part

BouwyBouwy Member Posts: 16 ✭✭
Can a gifted someone program a FeatureScript to adjust the sizes (X,Y) of the standard geometry planes to the max size of the part with the press of a button?
This would be very helpful when importing or making new small parts.

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    edited June 2016
    FeatureScript is only for creating new features and cannot be used to modify other/existing features. For this request you'll need to use the feedback tool. 
    Senior Director, Technical Services, EMEAI
  • cody_armstrongcody_armstrong Moderator, Onshape Employees, Developers, csevp Posts: 215
    @Bouwy  As @NeilCooke mentioned you will not be able to change the size of the standard planes in Onshape.  However, if you are feeling ambitious, check out the script below.  It creates 3 planes in the same location as front, top, and right, but their size is determined by the part you select and its distance from the origin.  I think this accomplishes what you are looking for.

    annotation { "Feature Type Name" : "Default Planes" }
    export const defaultPlanes = defineFeature(function(context is Context, id is Id, definition is map)
        precondition
        {
            annotation { "Name" : "Part", "Filter" : EntityType.BODY, "MaxNumberOfPicks" : 1 }
            definition.part is Query;
        }
        {
            const boxResult = evBox3d(context, { topology : definition.part });
            const partCenter = (boxResult.maxCorner + boxResult.minCorner) / 2;
            const origin = vector(0, 0, 0) * meter;
            const length = max(boxResult.maxCorner - boxResult.minCorner);
            const offsetLength = norm(origin + partCenter) * 2;
            definition.width = length + offsetLength;
            definition.height = length + offsetLength;
            definition.plane = plane(origin, vector(0, 0, 1), vector(1, 0, 0));
            opPlane(context, id + 1, definition);
            definition.plane = plane(origin, vector(1, 0, 0), vector(0, 1, 0));
            opPlane(context, id + 2, definition);
            definition.plane = plane(origin, vector(0, -1, 0), vector(1, 0, 0));
            opPlane(context, id + 3, definition);
        });
  • traveler_hauptmantraveler_hauptman Member, OS Professional, Mentor, Developers Posts: 419 PRO
    @Bouwy Adjusting construction plane size to fit the design context is the way things should work. You (and others) can help Onshape understand how they should prioritize it by voting for it in the improvement requests page : https://onshape.zendesk.com/hc/en-us/community/posts/207600948-Auto-Sizing-of-Planes-to-Part-s and you can share any finer points of what is important to you about this feature here: https://forum.onshape.com/discussion/2595/auto-sizing-of-planes-to-part-s


  • BouwyBouwy Member Posts: 16 ✭✭
    @NeilCooke; Nice insight, did not know that you can only add a feature and not change. I also noticed that the code of my part does not change if I make the planes smaller.
    @cody_armstrong; It is possible to change the planes but you have to do it manually. Nice workaround!, but changing the planes manually is my prefered method now.
    @traveler_hauptman; Voted it up (apparently already did) and added a comment to the thread. Thanks!
    Sound like a small adjustment in the source code of onShape, hope they change it soon!
Sign In or Register to comment.