Parametrics of scripts.

Parametrics of scripts.

matthewaudio
Contributor Contributor
504 Views
4 Replies
Message 1 of 5

Parametrics of scripts.

matthewaudio
Contributor
Contributor

I'm writing an add-in that creates equally spaced splines after asking the user to identify two bodies and the inside edge of a miter joint.  I'd like to account for the possibility of the edge of the miter joint not terminating in the same place on both the bodies. 

 

How do I do this while maintaining parametricity?   I could easily just find the shared edge and compute the location of the splines in python but that breaks parametricity so updating the model would ruin it! 

 

Ideally, I'd...

1) find and measure the shared edge parametrically,

2) sketch equally spaced points based on a point-along-path and

3) create the splines based on the points. 

 

 

 

Screenshot 2023-12-04 at 1.46.11 PM.png

 

 

Screenshot 2023-12-04 at 2.02.02 PM.pngScreenshot 2023-12-04 at 2.02.24 PM.png

0 Likes
505 Views
4 Replies
Replies (4)
Message 2 of 5

BrianEkins
Mentor
Mentor

To create a model that will fully utilize Fusion's parametric capabilities, you'll need to figure out how you would create the parametric model interactively. You should then be able to reproduce the same steps using the API.

 

I'm not sure I fully follow your description, but what about creating a sketch on one of the faces and projecting either the mitered edge or possibly the edge's vertices onto the sketch and then using those points? 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 5

matthewaudio
Contributor
Contributor

That first graph is a good food for thought.

 

I think what I’m asking is this.  Both bodies have an edge that shares a line but the parts of those edges that overlap could change.  

 

 How do I determine the shared portion of two edges parametrically?

Maybe what you’re saying is that expressions never depend on geometry, they only create it?

 

 

0 Likes
Message 4 of 5

Jorge_Jaramillo
Collaborator
Collaborator

Hi,

There isn't a parameter type to keep an edge as a reference:

Jorge_Jaramillo_0-1701780117534.png

You might need to either have someone select it or code the logic to discover such an intersection edge.

 

Regards,

Jorge Jaramillo

Software Engineer

 

Message 5 of 5

matthewaudio
Contributor
Contributor

@Jorge_Jaramillo  I'm sorry to belabor the point, but I actually feel like there must be an answer here. Let me see if I can simplify the example. 

 

How do we write a script that parametrically puts a point 1/3 of the way between two brepvertices selected by the user?  The positions of those vertices are dynamically calculated.

 

How do I do this?

 

Outside the simplified example, what I'm trying to do is dynamically place a spline 25% way across a mitered edge and maintain paramtetricity

0 Likes