Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Sketch orientation to line on sketch plane

brad.bylls
Collaborator
Collaborator

Sketch orientation to line on sketch plane

brad.bylls
Collaborator
Collaborator

I am creating springs to be able to place on any plane surface.

However, the cross section of the sketch does not always come out right.

Here is an image of my test piece.

Screenshot 2024-03-06 110623.png

Springs #1 and #5 have correct sketch orientation.

Screenshot 2024-03-06 111351.png

The length of rectangle #1 is parallel to line #1. This is correct.

This is correct for spring #1 and #5

The sketches for #2, #4, #5 and #6 are not correct.

Screenshot 2024-03-06 111905.png

The length of rectangle #2 is perpendicular to Line #2 not parallel.

I have been messing with this for some time and get figure it out.

Attached is all the add-in code.

Any help appreciated.

Thank you.

Brad Bylls
0 Likes
Reply
619 Views
7 Replies
Replies (7)

BrianEkins
Mentor
Mentor

I haven't looked at your code, but I do know that Fusion is a bit mysterious about how it creates sketches. When you select a face to create a sketch on, that defines the plane and the Z direction of the sketch, but the position and orientation of the X and Y axes are undetermined, and Fusion has some internal rules it uses when creating a sketch. I'm guessing that's the issue. If that is the problem, you'll need to figure out what the orientation of the sketch is and then use that information when drawing the geometry. The xDirection and yDirection properties of the Sketch should help with that.

 

There's code that draws the sketch coordinate system in this previous response so you can better visualize what's going on.

 

https://forums.autodesk.com/t5/fusion-api-and-scripts/coordinate-system-when-sketching-on-a-plane/m-...

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
1 Like

MichaelT_123
Advisor
Advisor

Hi Mr BradBylls,

 

Consider,

  1. draft a standard sketch(es) on XY,  (XZ) plane(s).
  2. Preferably on only one
  3. Pull from the sketch your spring
  4. Find a normal at the point you want to place the spring
  5. Based on the surface normal and perhaps other auxiliary info, apply an appropriate transformation to a body/component of the string
  6. Creation of the new occurrence is preferable
  7. More demanding option 
  8. Forget about sketches 
  9. and build a Coil Custom Feature

Benefits:

  1. you will avoid the problem with a sketch orientation
  2. you will make F360 sketch-pregnant only once
  3. so your Designess will be slimmer and more responsive
  4. you will also save on your tending time and the energy bill
  5. not to mention sketches screaming for continuous updates
  6. with a greater probability of a happy outcome

Alternativeonly if you are not in a hurry :

  1. Unless you want to build something more sophisticated than straight-squeesher
  2. Approach TF360 to upgrade the existing Coil Feature or Coil Primitive with new functionalities

Regards

MichaelT

MichaelT
1 Like

brad.bylls
Collaborator
Collaborator

@BrianEkins

Is it possible to set the direction? 

You see in the images I have and the rectangle and line. 

If I can set the direction, that should my problem. I just don't know how. 

Thank you. 

Brad Bylls
0 Likes

BrianEkins
Mentor
Mentor

Unfortunately, Fusion doesn't support defining the sketch orientation. The only edit that's supported is to change the plane it's on.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes

MichaelT_123
Advisor
Advisor

Hi Mr BradBylls,

 

Consider:

  1. Get the model coordinates of the auxiliary line (use: sketchToModelSpace())
  2. Transfer these coordinates to your sketch space (use: modelToSketchSpace())
  3. Based on it and other necessary macka-geegees, draw your rectangle

Regards

MichaelT

MichaelT
0 Likes

brad.bylls
Collaborator
Collaborator

@BrianEkins 

Changing the plane in this situation does not seem to be an option.

Brad Bylls
0 Likes

brad.bylls
Collaborator
Collaborator

@MichaelT_123 

I'm working with projecting an end point of the line and ModelToSketchSpace.

I hope then to compare it to the Sketch xDirection and maybe get something from that.

Not sure what I'm doing but plugging along.

Thanks for the tip.

Brad Bylls
0 Likes