Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sketch orientation to line on sketch plane

7 REPLIES 7
Reply
Message 1 of 8
brad.bylls
326 Views, 7 Replies

Sketch orientation to line on sketch plane

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
Labels (1)
7 REPLIES 7
Message 2 of 8
BrianEkins
in reply to: brad.bylls

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
Message 3 of 8
MichaelT_123
in reply to: brad.bylls

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
Message 4 of 8
brad.bylls
in reply to: BrianEkins

@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
Message 5 of 8
BrianEkins
in reply to: brad.bylls

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
Message 6 of 8
MichaelT_123
in reply to: brad.bylls

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
Tags (1)
Message 7 of 8
brad.bylls
in reply to: BrianEkins

@BrianEkins 

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

Brad Bylls
Message 8 of 8
brad.bylls
in reply to: MichaelT_123

@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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report