28 Replies Latest reply on Jan 5, 2018 3:39 AM by Marc Plensou

# Equal spacing equation

Hi

Could help me with what should be a simple equation for an equation expert!!!

In the attached there is a frame work. What I would like is to come up with an equation that would equally space out the inner tubes regardless of how many there are. So for example I would like 4 inner tubes with 5 equal gaps, if however I wanted to change it to 7 spaces the gaps would respace automatically.

This attached is just an assembly for this exercise, however this is something that crops up quite a lot in my work and at the moment I'm getting out the calculator and doing the maths. I'm sure it would be much easier if I could do it with an equation.

Any help would be greatly appreciated.

Thanks

Steve

• ###### Re: Equal spacing equation

Hi Steve,

I put together the equation then realised it was a 2015 file so couldn't send you back:

"Inside Width" = Use the ref dimension you have

"Width of Component" = Create a ref dimension of the width of the first member in the series

"Number of Instances" = Driven by pattern instances

"Free Space" = "Inside Width" - ("Number of Instances" * "Width of Component")

"First Component Space" = "Free Space" / ("Number of Instances + 1)

"Pattern Spacing" = "First Componenty Space" + "Width of Component"

Then apply width mate to position first component and apply variable First Component SPace to drive this and Pattern spacing to drive component pattern spacing.

Hope this makes sense. See below for an example.

• ###### Re: Equal spacing equation

Hi Martin

Thanks for taking the time to do this. Feel free to post up the file. I did a file at home where I'm running 2016 and it opened here at work in 2015.

Thanks again

Steve

• ###### Re: Equal spacing equation

Hi

I followed your instructions and it works great. I have asked solidworks through improvement requests if this solution could be turned into a mate of some description (still waiting ha ha). In a previous piece of software I used years back namely Turbocad you could do this with 3 clicks. You clicked both inside faces and then one of the internal components and everything spaced out equally.

Maybe one day it could get incorporated in to the software, however until then I have this as a solution.

Thanks

Steve

• ###### Re: Equal spacing equation

That would be a great enhancement! I guess until that point it's down to good old calculations I have to admit I still like it when the calculation turns out correct. I dare say you could write a Macro that could do what you have mentioned. You could try asking in th API section see if anyone has any ideas?

• ###### Re: Equal spacing equation

There are others ways.

1.  Pattern driven Pattern

2.  Sketch driven pattern

Steve C

• ###### Re: Equal spacing equation

Hi

From one Steve C to another!!!

Using my frame above could you possibly show me an example of how that would work.

Thanks

Steve

• ###### Re: Equal spacing equation

So, without doing the actual modeling I'll give it a try.  I'm in between opening and working on some larger assemblies...

1.  Pattern driven Pattern:  You make a pattern of a hole on the inside of the top and bottom rail (same part I'm thinking).  That pattern is equally spaced between the end of the rail.  You mate one vertical using the first hole as a mate aligmnent and then use the Pattern Driven Component.  It should see the pattern of holes you used in the rail and populate the assembly with that number of verticals.

2.  Sketched driven Pattern:  About the same as above except you use a separate sketch with points

Both of these are in the help.

Steve C

• ###### Re: Equal spacing equation

This Is what I did at a part level. I've done this at both a part level and a Assembly level.  O will reply in the newer post also.

• ###### Re: Equal spacing equation

Just curious: why don't you use the "up-to-reference" pattern? No need for equations in 2015 and 2016.

• ###### Re: Equal spacing equation

Hi Alin

That option is not available in assemblies as far as I can tell.

Thanks

Steve

• ###### Re: Equal spacing equation

That is true. That being said, as long as you would not mind having a pattern feature in dummy part driving the assembly pattern, is doable.

• ###### Re: Equal spacing equation

So I guess this is what I was trying to accomplish and since I don't have SW2016 loaded I cannot show it.

If you use the sketch pattern of the part level equal spacing "up to reference" as Alin has suggested and mate the vertical components via the pattern, you'll always get an equal spacing, right?

Steve C

• ###### Re: Equal spacing equation

This is very interesting. I have been looking for something like this.

I have a very similar challenge. My framework is like the above, but without mates and on part level.

What I want it to do, is to equally space out the balustrades to a maximum spacing of 89 mm, regardless of the overall length of the framework. So when changing the length from 1500 mm to 2300 mm, it would calculate the new number of balustrades with a new spacing up to maximum 89 mm.

I would like to create a part, which I can run in DriveworksXpress to generate types with different lengths and heights.

Anyone able to help?

• ###### Re: Equal spacing equation

So I'm currently taking a shot at this hoping that I'm matching your design intent.  I started in railings and staircases so this is a TBT on Wednesday for me

Is there a reason you're using extrudes instead of weldments?

• ###### Re: Equal spacing equation

Alright here is my take on what I understood that you were trying to do.

• ###### Re: Equal spacing equation

Thank you. I have just taken a look at it. It looks like the spacing in between the "rods" is the same (center to center distance: 10mm + the spacing) But the first and the last spacing isn't the same. The distance is the same, but the point where it measures from an to is not.

So the first and last spacing is 5mm smaller, than the rest.

I have struggled with this too and I came up with an equation, that seems to work but the model does not update correct.

I am new to SW and very new to the equations SW can do, so I may have to correct them several times.

I used extrudes just to get started on something "easy".

• ###### Re: Equal spacing equation

I looked through your part and the way that you have the instances set up is rather awkward.  I've found that you have far less problems if you always ensure that your instance is a integer.  I fixed my picket spacing error and have the adjusted part as well as 2 versions of the equation text file attached.

• ###### Re: Equal spacing equation

This is looking great.

It seems to calculate the number of instances and spacing between them correct, regardless of the length.

It does come up with a syntax error upon changing the values in the equation manager. I attached a screenshot of the dialog box.

Can I do anything about that error?

Can I use parts with equations like this, to create standards in DriveWorksXpress?

• ###### Re: Equal spacing equation

Not sure where the syntax error came from.  Should be able to make that a DriveWorksXpress version. I have too many custom projects to be able to turn my versions into driveworks standards.

• ###### Re: Equal spacing equation

if you are on 2017 or newer, the new "up to reference" option in linear patterns makes this sort of thing much easier.

• ###### Re: Equal spacing equation

With what Marc Plensou has said he needs the pickets to be a max to match building code.  So it actually is better with the equation.  I tried similar with SW2015 but a similar equation was my best option then.

• ###### Re: Equal spacing equation

@Jeremy

I have tried the "Up to reference", but it doesn't do what I need of it.

I needed it to automatically insert the right number of pickets with the correct spacing up to a max 89 mm, regardless of the length

of the frame and the dimension of the pickets. The max of 89 mm comes from a building code as Arthur says.

I have experience with AutoCad and  Revit too, and they can more or less construct railings and stairs with a push of a button, that's what I am after, so I don't have to model from skratch every time and the equations makes it a lot faster.

@Arthur

The equations you made Arthur seems to work great. Thank you for your help

How do I convert the equations from extrudes to weldments?

I am missing some of the dimensions.

• ###### Re: Equal spacing equation

I didn't say equations would not be needed, or that the up to reference would solve your problem. only that it should make it easier to solve.

thanks,

• ###### Re: Equal spacing equation

The difference with using weldments is how you base your sketch. The linear pattern would then be a body pattern instead of a feature pattern.

• ###### Re: Equal spacing equation

@Jeremy

No worries, I have tried out a few options that didn't woork, but the equations seem to work.

@Arthur

I think I got it. The sketch for weldments needs to be a little different.

I tried out some various sketches, so far so good.

• ###### Re: Equal spacing equation

I have an update to this subject.

Their Words "Your request was a popular one and has been implemented by our development team.  As of SWX 99 we now support the functionality that you requested in the following enhancement request:  You can use = round ( ( 11.68 ) , 0 ) in order to get 12

SW was already able to round Down and I needed it to also round up.

I haven't tested it myself yet.

• ###### Re: Equal spacing equation

Good morning all. I am relatively new to the forums and just found this thread. I have benefited from the forums, so I thought I might try to contribute a little also. I do staircase and railing design and have ran into this issue. I have been doing my designs as assemblies and had decided not to mess with trying to build my formula into SW. My solution had been to create an Excel spreadsheet that ran the formulas for me. The downside is that if the design specs change then you need to remember to change the pattern spacing, but this has worked for me. My excel file is attached, hopefully someone else could also use it.

• ###### Re: Equal spacing equation

Hello Joel

Welcome aboard.

I am new to the forum myself, in fact this is the first thread I have posted in.

Do you use your Excel spreadsheet to do the calculations for you, so you can manually build your designs?

I was looking for a way to automate my railings, posibly future stairs. Arthur was very helpful in this way, so now I have the equations to get solidworks to automatically calculate the number of balustrades and the spacing between them, up to maximum spacing.