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.

Importing frame profiles

graham_lockgraham_lock Member Posts: 233 PRO

Hi,

I want to draw a frame in FS using a profile from a library.

I have a Frames Profiles library from which I've imported the relevant profile into my feature:

PROFILE::import(path : "f291b1eeec6c54398a176be9/f64054ef666d4cf2737b88c5/356fb47928ccd52d07b1cf3e", version : "d6585a638c0d2d07f1a1c625");

I then build the profile context and merge into the current context (not sure if this is required?):

// Build a profile in a separate context
var contexWithProfile is Context = PROFILE::build();
opMergeContexts(context, id + "addProfile", {
"contextFrom" : contexWithProfile
});

I then have the following taken from Part Studio code view:

frame(context, id + "frame1", {
"profileSketch" : { "buildFunction" : df291b1eeec6c54398a176be9::vf64054ef666d4cf2737b88c5::e356fb47928ccd52d07b1cf3e::md6585a638c0d2d07f1a1c625::build,
"configuration" : {},
"partQuery" : qUnion([SbrDYwOkrUaWCG_query]) } as PartStudioData,
"selections" : qUnion([nDdJjqMVnfidOd_query]),
"lockProfile" : false,
"profileLockFaces" : qUnion([]),
"mergeTangentSegments" : true,
"angle" : { 'value' : try(-2 * degree), 'expression' : "-2 deg" }.value,
"mirrorProfile" : false,
"angleReference" : qUnion([]),
"defaultCornerType" : FrameCornerType.MITER,
"defaultButtFlip" : false,
"cornerOverrides" : [],
"trim" : false,
"trimPlanes" : qUnion([]),
"trimBodies" : qUnion([]),
"index" : { 'value' : try(7), 'expression' : "7" }.value
});

My question relates to the

profileSketch and partQuery parameters - how should that query be created?

Any help appreciated.

Thank you.

Answers

  • graham_lockgraham_lock Member Posts: 233 PRO

    As an aside I have a working solution where the frame profile is manually selected via a user input field, which for my use case is probably fine.

    annotation {
    "Library Definition" : "65dcc2a02c4ff1c239467ec9", // This is the id of the Onshape Frame Profile Library definition, including this displays the frame profile tab in the Part Studio selector dialog box
    "Name" : "Sketch profile",
    "Filter" : PartStudioItemType.SKETCH,
    "MaxNumberOfPicks" : 1,
    "UIHint" : UIHint.REMEMBER_PREVIOUS_VALUE
    }
    definition.frameProfile is PartStudioData;

    frame(context, id + "frame1", {
    "profileSketch" : definition.frameProfile,
    "selections" : qUnion([splinePath]),
    "lockProfile" : false,
    "profileLockFaces" : qUnion([]),
    "mergeTangentSegments" : true,
    "angle" : definition.profileAngle,
    "mirrorProfile" : false,
    "angleReference" : qRightPlane(EntityType.FACE),
    "defaultCornerType" : FrameCornerType.MITER,
    "defaultButtFlip" : false,
    "cornerOverrides" : [],
    "trim" : true,
    "trimPlanes" : qUnion([qNthElement(definition.formerFaces, 0)]),
    "trimBodies" : qUnion([]),
    "index" : { 'value' : try(1), 'expression' : "7" }.value // the connection point index
    });

Sign In or Register to comment.