Community
Fusion Design, Validate & Document
Stuck on a workflow? Have a tricky question about a Fusion (formerly Fusion 360) feature? Share your project, tips and tricks, ask questions, and get advice from the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Patterning by translation and rotation

34 REPLIES 34
SOLVED
Reply
Message 1 of 35
casey.rogers
9202 Views, 34 Replies

Patterning by translation and rotation

I'm trying to make a spiral staircase based off a design I previously made in Inventor.  It appears I cannot use one of the strategies I used in inventor so I'll have to do it a different way. Basically I have one step already:

And need to copy it upward <distance> <quantity> times while also rotating each copy about the y axis relative to the previous copy by <degrees> in order to create a full staircase. It'd be sort of similar to a rectangular pattern where the first direction is distance along the y axis and the second direction is rotation about the y axis.
Here is a picture of the step patterned upward. I manually rotated the bottom step using the move tool and could manually rotate the rest of the pieces but I am designing the staircase to be parametric where one of the parameters is the number of the steps so that's not an option.

In Inventor I used a rectangular pattern with only one direction-a helix curve that matched the above rotation and translation. In my Fusion shots, I'm using a triangular coil to generate a helix curve because, AFAIK, Fusion doesn't yet have a helix tool. Fusion's rectangular pattern does not appear to accept helix curves as directions and pattern along a path does not give the desired result-it tilts the stairs and does not rotate perfectly around the y axis.

As is I can't seem to figure out how to accomplish this with Fusion's toolset, anyone have any ideas? Is using non-striaght lines for rectangular pattern directions (like you can in Inventor) in the works for Fusion?

34 REPLIES 34
Message 2 of 35

Hello,

 

Fusion doesn't have the same pattern as Inventor, so the work flow isn't such smooth. You can try this workaround:

- create your step and make rectangular pattern copy bodies.

- select all bodies except body 1 and open move command

- set pivot to axis of rotation

- set rotation of steps for example 20deg

select all bodies except body 1 and body 2 and open move command

repeat it until you reach the last step

patern.PNG

 

 

regards

Martin

 



Martin Zatecka
UX Designer
Message 3 of 35

Thanks for the quick reply! Unfortunately this will not work for me as the design is parametric where one of the parameters is step size. AFAIK, I can't paramaterize repititions of the move command. Am I just out of luck?

Message 4 of 35

I think, there is no way to create fully parametric driven model for your design.

You would control the pattern, but the rotation of each step seems to be manual work.

 

I posted request for enhancement

 

regards

Martin



Martin Zatecka
UX Designer
Message 5 of 35

Hi casey.rogers,

 

Martin is correct, the way you want to create a spiral staircase with patterning is not possible in Fusion360 today and since Martins recommendation won't work for you the only way to be able to do this is to manually build each stair in a sketch and control it using parameters.  I've included a sample of one approach you will be able to achieve what you are trying to do.  it is a bit tedious, but it can be done.  See the attached image and I've included the Fusion asset for you to look at.

spiral stair_sample.png

 

this should get you there.

 

let me know if you you have any further questions.

 

hope this helps,


Jamie Gilchrist
Senior Principal Experience Designer
Message 6 of 35

HI casey.rogers,

 

here is another approach using a single sketch and doing a linear pattern of the skecth, then doing a revolve of each profile around a common axis and doing a two sided direction of the revolve. You could easily use this approach and add parameter to control the design (I did not add any parameters in this example) attached Fusion asset.

spiral stail_opt2.png

 

hope this is helpful. 

hope this helps,


Jamie Gilchrist
Senior Principal Experience Designer
Message 7 of 35
jan_priban
in reply to: casey.rogers

Hello Casey,

 

I see your post interensting and suitable task for API script. Please find attached JavaScript file. It generates helix stairs for you. First create base/master stair and convent it to component. Script paterns fist component. Than create center pillar, other geometry. 

 

It paterrns around default vertical (green) axis. See artical http://help.autodesk.com/cloudhelp/ENU/Fusion-360-API/files/WritingDebugging.htm describing how to define API script - nothing diffucult.

Paste source code and run. Enter number of stars, level distance, angle between start. Advantage: All occureneces refer to base stair, so any change made on base stair is propageted to all/each stair

 

When generate, save it as file STAIRS and insert it to you design like HOUSE file. Hope you will find it usefull.

 

Regards

 

Jan Priban, Autodesk

 

//Author-JP
//Description-tocite schody

function run(context) {

"use strict";
if (adsk.debug === true) {
/*jslint debug: true*/
debugger;
/*jslint debug: false*/
}

var ui;
try {
var app = adsk.core.Application.get();
ui = app.userInterface;

var product = app.activeProduct;
var design = adsk.fusion.Design(product);
if (!design) {
ui.messageBox('No active Fusion design', 'No Design');
return;
}

// Get the root component of the active design.
var rootComp = design.rootComponent;
var occs = rootComp.allOccurrences;

// Gather information about each unique component
var count = occs.count;
//ui.messageBox(count.toString(), 'pocet');

//jmena vsech component
var i;
//for (i = 0;i < count;++i) {
// var comp = occs.item(i).component;
//ui.messageBox(comp.name, 'jmeno');
//}

//var comp = occs.item(0).component;
//var jmeno = comp.name
//ui.messageBox(jmeno,'jmeno');

// Prompt the user for a string and validate it's valid.
var StairsCount = '20'; // The initial default value.

// Get a string from the user.
var objIsCancelled = [];
StairsCount = ui.inputBox('Enter Stairs Count', objIsCancelled, 'Stairs Count', StairsCount);


// Exit the program if the dialog was cancelled.
if (objIsCancelled.value) {
adsk.terminate();
return;
}

// Prompt the user for a string and validate it's valid.
var StairsAngle = '20'; // The initial default value.

// Get a string from the user.
var objIsCancelled = [];
StairsAngle = ui.inputBox('Enter Stairs Angle [deg]', objIsCancelled, 'Stairs Angle', StairsAngle);


// Exit the program if the dialog was cancelled.
if (objIsCancelled.value) {
adsk.terminate();
return;
}

// Prompt the user for a string and validate it's valid.
var StairsLevelDistance = '100'; // The initial default value.

// Get a string from the user.
var objIsCancelled = [];
StairsLevelDistance = ui.inputBox('Enter vertical distance between 2 stars [mm]', objIsCancelled, 'Stairs Level Distance', StairsLevelDistance);
StairsLevelDistance = StairsLevelDistance / 10;


// Exit the program if the dialog was cancelled.
if (objIsCancelled.value) {
adsk.terminate();
return;
}


// Use the value for something.
//ui.messageBox('User entered ' + StairsCount );

// Create a new occurrences.
var trans = adsk.core.Matrix3D.create();
var pi = 3.1415927;

for (i = 1; i < StairsCount; i++) {
trans.setToRotation(3.1415/180*StairsAngle*i,adsk.core.Vector3D.create(0,1,0),adsk.core.Point3D.create(0,0,0));
trans.setCell(1, 3, StairsLevelDistance*i);
var newOcc = rootComp.occurrences.addExistingComponent(occs.item(0).component, trans);
}

}
catch (e) {
if (ui) {
ui.messageBox('Failed : ' + (e.description ? e.description : e));
}
}

adsk.terminate();
}

 

 

BaseStair.jpg       Stairs.jpg

 

 

 

 

 

Message 8 of 35
LMD001
in reply to: jan_priban

Hello Jan,

 

Nice script you wrote there!

 

Is not really a big deal but is there a way for the inputbox (distance between stairs) to accept a comma as decimal point?

 

Many thanks for the script.

 

Best regards,

Ludo

Message 9 of 35
jan_priban
in reply to: LMD001

Hello Ludo,

 

not big deal, just add one magic line, replace decimal comma by decimal point

 

Sniplet:

 

// Prompt the user for a string and validate it's valid.
var StairsLevelDistance = '100'; // The initial default value.

// Get a string from the user.
var objIsCancelled = [];
StairsLevelDistance = ui.inputBox('Enter vertical distance between 2 stars [mm]', objIsCancelled, 'Stairs Level Distance', StairsLevelDistance);
StairsLevelDistance = StairsLevelDistance.replace(",", ".");
StairsLevelDistance = StairsLevelDistance / 10;

// Exit the program if the dialog was cancelled.
if (objIsCancelled.value) {
adsk.terminate();
return;
}

Message 10 of 35
LMD001
in reply to: jan_priban

Hi Jan,

 

Thanks!

 

Ludo

Message 11 of 35
casey.rogers
in reply to: casey.rogers

Thank you for all the feedback! I've been experimenting with the API and was intending to convert my staircase into an add-in! Jan, do you mind if I use your script to create my own add-in?

Message 12 of 35
jan_priban
in reply to: casey.rogers

Hello Casey,

 

feel free to use any API sniplet published here.

 

Regards

 

Jan

Message 13 of 35
Pavel_Holecek
in reply to: jan_priban

Hello,

 

We (Me and Jan ) have prepared newer version ‘Patterning by translation and rotation’  which we call  ‘Spiral Pattern’ command now.

Benefits of this new command:

  • allows you to select more Components
  • possibility to select Rotation Axis
  • there is possible to specify units (mm, cm, m, deg)
  • allows to use ‘Measure’ to specify magnitude

 

In this example is also possible to see how to use Fusion Command in JavaScript.

 

How to run JavaScript&colon;

  1. Copy ZIP file to this location - c:\Users\<user_name>\AppData\Roaming\Autodesk\Autodesk Fusion 360\API\Scripts\
  2. Extract ZIP file( JS and HTML )
  3. Run ‘Fuison 360’ and go to menu File-->Scripts and Add-Ins
  4. Click on ‘Plus’ icon in ‘My Scripts’ and browse extracted JS file
  5. Run ‘SpiralPattern’ script

Scripts and Addins.png AddMyScripts.png

 

Regards

Pavel

Pavel Holecek
Autodesk QA team
Message 14 of 35
LMD001
in reply to: Pavel_Holecek

Hello Pavel and Jan,

 

Kudo and thanks for the script!

 

Best regards,

Ludo

Message 15 of 35
skrubol
in reply to: Pavel_Holecek

The Spiral Pattern script no longer works for me.  Is there something one of the recent updates broke?

I immediately get the error:
command created failed: TypeError: Object #<CommandInputs> has no method 'addRangeCommandIntegerInput'

Then after selecting the component and axis I get the error:
command executed failed: TypeError: Cannot read property 'valueOne' of undefined

 

My Java is extremely rusty, so these errors don't mean a lot to me.

Thanks for any help.

Message 16 of 35
Pavel_Holecek
in reply to: skrubol

Hello

 

This error is cause by a change in API. There was changed a command Input method. There is enough to modify one method on one row to correct  the script.  Try to find this row  - OLD method:

var distance = args.command.commandInputs.addRangeCommandIntegerInput(commandId + '_number', 'Occurrences Number','', 2, 100);

 

and replace it with this row where is used NEW method:

var distance = args.command.commandInputs.addIntegerSliderCommandInput(commandId + '_number', 'Occurrences Number', 2, 100);

 

Let me know if it helps.

 

Pavel

Pavel Holecek
Autodesk QA team
Message 17 of 35
skrubol
in reply to: Pavel_Holecek

Thanks!  Looks like that did the trick!

 

On another note, should this thread be in the API forum?

Message 18 of 35
Anonymous
in reply to: skrubol

Hi all. 

I have similar problem to solve, and I cannot run the script. 
The dialog does not shows. 

My current version of Fusion is 2.0.2539. 

I loaded JS file, and after pushing Start - no dialog appears. 
Same with Debug button. 


Regards, 
Pawel from Prototypujemy.pl

Message 19 of 35
Pavel_Holecek
in reply to: Anonymous

Hello,

 

I updated this script and checked it on 2.0.2541 version - it works fine on my machine.

 

Regards

 

 

Pavel Holecek
Autodesk QA team
Message 20 of 35
Anonymous
in reply to: Pavel_Holecek

Thanks. 

I had an issue related to installation of the script. Namely, I tried to put files with Script to 
~/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts

however I used Mac App Store to install Fusion. Therefore I had to use 
~/Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk/Autodesk Fusion 360/API/Scripts

Which was not clear - Script appeared on the list of Scripts, but nothing happened after pushing "Play". 

Now - it works like a charm! Thanks a lot!

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report