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.
Why are my variables not working when set for feature driven pattern
brad_phelan
Member Posts: 89 ✭✭
I have the following profile designed using a variable width
In my custom feature I have tried the following
The profiles are patterned
but the two new sketches don't accept the width variable. Any idea what I am doing wrong?
In my custom feature I have tried the following
annotation { "Name" : "Profile", "Filter" : SketchObject.YES, "MaxNumberOfPicks" : 1 }
def.profile is FeatureList;
...
...
setVariable(context, "width", 115 * millimeter);
applyPattern(context, id + "sk0", {
"patternType" : PatternType.FEATURE,
"instanceFunction" : valuesSortedById(context, def.profile),
"transforms" : [transform(vector(50, 0, 0) * millimeter)],
"instanceNames" : ["a"]
}, identityTransform());
setVariable(context, "width", 315 * millimeter);
applyPattern(context, id + "sk1", {
"patternType" : PatternType.FEATURE,
"instanceFunction" : valuesSortedById(context, def.profile),
"transforms" : [transform(vector(100, 0, 0) * millimeter)],
"instanceNames" : ["a"]
}, identityTransform());
The profiles are patterned
but the two new sketches don't accept the width variable. Any idea what I am doing wrong?
Tagged:
0
Best Answers
-
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭check if the entity that is refferenced by the "width" dimension is internal geometry of the sketch, i would reccomend put a point to the sketch origin and apply a fix constrain to it. then dimension everything relative to this point/ all the external sketch refferences are droped by feature pattern and it is the main problem
5
Answers
for(;;;){
setVariable(context,...);
applyPattern(context,...);
}
it would be nice if applyPattern had an extraparameter
variables of type array of map where variables for each instance could be set.
definition.entities = definition.bodies;
definition.instanceNames = names;
definition.transforms = transforms;
for (var k = 0; k < size(transforms); k += 1)
{
setVariable(context, "dCharacteristic", .030*(1 + (k*.002))*inch);
applyPattern(context, id + ("pattern" ~ k), definition, remainingTransform);
}
If you click the FeatureScript notices button it will flyout a console output on the bottom of the screen If you toggle on Monitoring you can see the result of the last committed script