How to Set a Number of Points in a Sketch in Relation to a Length

Hello,  I have a plate where the length and width are configurable, basically it has 4 holes.

I would like to increase the number of holes according to its length and width. For example: 0 to 300mm, 2 holes; from 300 to 600; 3 holes, from 600 to 900, 4 holes.... etc..

And in the assembly, I would like the associated screws and the supports to automatically start with a repetition driven by a sketch.

I tried in different ways, but no result, I wanted to use the "TRUNCATE" function found in excel, but in SW it doesn't work... The goal was to take a "dimensioned" line as a reference, subtract 100mm (for example) and divide by 300 (in mm, to have the number of holes...) and to control a sketch that automatically generates the number of points... which will be used for rehearsal; anyone have an idea please?

 

 


plaque.png

Hello

It's quite simple, you create a parameter with a formula
...

The simplest, I attach the file to you, it avoids very long speeches.
You just have to change the values in the properties.

 

Jerome


repetition_trou.sldprt
2 Likes

hello, thank you for the answer, on the other hand impossible to open the Attachment...

 

I did a test again, here's what I manage to do...

on the other hand it does not do an automatic update (you have to update to see the modifications..) and above 300mm in length, it crashes, finally, the repetition function is at fault... any lead please?


panel2.sldprt

Good evening yannick.scher

Here is the formula I would use for your case

"centre distance" = ( "D1@Esquisse1" - "D1@Esquisse2" - "D1@Esquisse2" ) / ( "D2@Esquisse2" - 1 )

D1@Esquisse1 = total length

D1@Esquisse2 = hole location relative to the edge  (subtracted twice for the same position of the 1st and last holes relative to the two edge)

D2@Esquisse2 = number repetition -1 to get the center distance

 

I link the spacing  value (entraxe@Esquisse2 with variable spacing)

Then vary  the number of occurrences of the repetition and length  as needed. Updated by Ctrl+B

Attached is the Solidworks file

Is this what you were looking to do?

CDLT

 

 

 


percage_equation.sldprt
2 Likes

Here is the updated file with a family of parts for control and configuration creation.

Good night


percage_equation.sldprt
1 Like

Thank you for this feedback, it could be a lead, but I would also like to calculate the number of repetitions in an automatic way...

on the other hand I have a problem downloading the files, when I click on them, the browser opens a new page with all the file written in it..; impossible to "download" it, anyone have a solution?

 

To vary the number of repetitions according to the value of the total length:

Nb repetition = int ( " D1@Esquisse1" / 400 ) + 1 with D1@Esquisse1 = total  length and 400 the desired maximum step

int rounds the value to the nearest whole number.

1 Like

To download the attachment try "Right click on it / save link as"

To download the attachment try "Right click on it / save link as"

2 Likes

Hello

Sorry but a very busy week...
@yannick did you manage to use the file I published? I forgot to mention that I was on SW 2019.
A trick so that the center distance calculates itself. is to go through a sketch with several lines.
In the dimension you update your formulas, then you reuse its dimensions to define your repetitions and repetition distance.

With : "Nb_Repet"= int("length"/300)+1
centre distance =( "Length" - 30 ) / ( "Nb_Repet@Esquisse4" - 1 )
Of course you have to associate your length dimensions with the customize parameter

You change your settings and start a rebuild. And that's it..

 

Jerome

 

1 Like

Thank you for the explanations!

I went through Chrome to be able to download the attached files.

I put in PJ what I can do, a small question again, I would like to automatically delete the last 3 functions of my parts according to the width (if less than 350, no drilling on the width..) same in my assembly.. Any idea?


panneau_4.sldprt

And now, the zip with the complete assembly with the parts


panneau_4.7z