Overriding part mass with an equation

laukejas
Posts: 129
Joined: Sun Sep 05, 2021 8:27 am
Answers: 0
x 33
x 84

Overriding part mass with an equation

Unread post by laukejas »

Hi, this might be an unusual question, so I'll explain the context first. I design a lot of parts in SW that will be 3D printed with partial infill. I usually know the percentage of the infill in the design phase, but the infill geometry is generated by slicer software after exporting from SW. Mass calculations are very important in my designs, and I like to keep track of them while making changes to the part. Now, although I know the densities of the plastics I am going to use, that doesn't account for partial infill. So if I design a solid part in SW and assign the material, it's mass won't be realistic since it doesn't account for the infill. Ideally, I would like to override the mass of the SW part with an equation like =SW-Mass * 0.1, where 0.1 represents 10% infill (this doesn't account for the shell, but I'm keeping it simple here). However, as far as I know, there is no way to override mass for a part with anything parametric. So what are the alternatives?

Things I considered:
1) Creating a configuration of the part where the solid body is shelled to particular thickness until a realistic mass is achieved (I can tune this against the slicer mass predictions), and after I make modifications to the part, shelling would still correct the mass to an acceptable degree. Issue is, this won't work since a lot of parts cannot be shelled due to their complex geometry, or are multi-body parts and it would be very tedious to shell each one.
2) Create multiple materials that have mass densities adjusted to account for infill, for example: PLA-5, PLA-6, PLA-7, representing 5%, 6%, 7% infills, etc. However, this also won't work since I'd have to create dozens if not hundreds of materials like this.
3) Use Equations to calculate the adjusted mass, and maybe output it to Custom Properties. Not bad, but it won't let me do center of mass calculations in assembly, which is also very important (different parts will have very different infills, so it matters).
4) Use a macro that runs on every save/rebuild, and overrides the mass by re-calculating it from the SW-Mass - my last resort, I'd like to avoid this if at all possible, such macros are pretty nasty.

If only I could create a body in the part with negative mass that would offset the actual mass by a parametric amount... Unfortunately SW doesn't support exotic matter yet :D

Can anyone suggest a better approach?
User avatar
zwei
Posts: 700
Joined: Mon Mar 15, 2021 9:17 pm
Answers: 18
Location: Malaysia
x 185
x 598

Re: Overriding part mass with an equation

Unread post by zwei »

I would personally suggest option 2. This also let you keep track the amount of infill you are using in the bom more easily (assuming you have infill percentage assigned to material name).

Batch creating material is not as hard as you think..
The *.sldmat file is basically just xml file, so you could first create an excel file that calculate the density based on infill, then export them in xml format

image.png
Far too many items in the world are designed, constructed and foisted upon us with no understanding-or even care-for how we will use them.
User avatar
josh
Posts: 253
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 11
x 19
x 444

Re: Overriding part mass with an equation

Unread post by josh »

Just don't assign a material. Then you can set your density manually to whatever you want.
image.png
laukejas
Posts: 129
Joined: Sun Sep 05, 2021 8:27 am
Answers: 0
x 33
x 84

Re: Overriding part mass with an equation

Unread post by laukejas »

Zhen-Wei Tee wrote: Sun Aug 20, 2023 6:16 pm I would personally suggest option 2. This also let you keep track the amount of infill you are using in the bom more easily (assuming you have infill percentage assigned to material name).

Batch creating material is not as hard as you think..
The *.sldmat file is basically just xml file, so you could first create an excel file that calculate the density based on infill, then export them in xml format


image.png
I tried this route - pretty neat! The only downside is, having so many materials, and if I want to update some properties of them, now I have to go into the XML and batch change it for every single one. Aside from that, this is quite good.
josh wrote: Mon Aug 21, 2023 7:17 am Just don't assign a material. Then you can set your density manually to whatever you want.
I also like this solution. I just realized it wouldn't really work for parts with multiple bodies where each body would have different amount of infill, but I didn't mention that in my initial post, so this solution is still valid as per initial requirement. I threw together a quick macro to assign material density and infill percentage, and it modifies that value in the document properties accordingly. It also remembers the last input values. Attaching to this post.

Set density by infill.swp
(64.5 KiB) Downloaded 23 times
Post Reply