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.

how to evaluate extrude direction so it can be used in a transform

owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
Hi folks.

Hopefully an easy one this time.

I'm creating a body using an extrude from a sketch.

Having made it I may wish to transform it in the direction of the previous extrude operation.

I can use the qCreatedBy query to grab the body for the entity parameter but am having difficulty evaluating the extrude direction for the "transformDirection" parameter.  (If we can't use the extrude direction can we use "normal to the sketch" the extrude was performed with?)

if (definition.SubFlush)
                        {
                            transform(context, id + i, {
                                    "entities" : qCreatedBy(id + i + "extrudeNutDown1", EntityType.BODY),
                                    "transformType" : TransformType.TRANSLATION_DISTANCE,
 >> Here>>                   "transformDirection" // Evaluate The direction of the extrude in (id + i + "extrudeNutDown1") ,
                                    "distance" : SubflushExtraDepth * millimeter
                            });
                        }

I think this is the last line of fs code preventing this widget working properly so any help appreciated.

Cheers,
Owen S.

Business Systems and Configuration Controller
HWM-Water Ltd

Best Answers

Answers

  • mahirmahir Member, Developers Posts: 1,304 ✭✭✭✭✭
    Can you query for the feature that created a body or surface? If you can locate the extrude, then the extrude direction is a vector property of that extrude's definition map. Or... I'm just talking out my ass.
  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    Thanks for your input chaps.  It's working now :-)

    As ever there are many ways of getting to the same end result, I was missing an obvious one.  All useful to learn from so nothing wasted.

    Thanks,

    Owen S.
    Business Systems and Configuration Controller
    HWM-Water Ltd
Sign In or Register to comment.