Author Topic: Resize a STL File For Me  (Read 13240 times)

0 Members and 3 Guests are viewing this topic.

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Resize a STL File For Me
« on: January 18, 2024, 05:02:19 am »
I am in need of a rotary knob with a 6mm D shaft.

I found one on Thingiverse, however, the diameter and height is too big. To confirm whether the style was correct, earlier I printed the one in the attached file, and, as expected, it's too large (it covers writing on the front panel).

My slicing software allows me to scale it, however, it also scales the D shaft hole.

Attached is the zip file from Thingiverse.

Does anyone have software that will scale it without affecting the center shaft hole size?

It needs to be approx. 13mm height, 18mm diameter at the inside end, 17mm at the outside end, and the inside needs to be 3.15mm hollow before the D part of the hole starts (if this makes sense).

Trying to tweak the hole for the shaft may not be feasible, but thought to throw out that size too.

This knob is for an adjustable power supply. The knob broke and was thrown out by someone. If the knob is too large in diameter, it covers writing on the front panel. If the shaft is too deep, then the button can't be pressed (it rotates and also has a on/off press function). I thought to try making one myself on SketchUp, but I wouldn't know how to create the side notches.

 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4079
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Resize a STL File For Me
« Reply #1 on: January 18, 2024, 06:51:30 am »
Editing STL with many faces like this is complicated. If you can't scale it in the slicer (eg: prusaslicer can scale on separate axis) then you may be better of searching for a parametric knob.

eg:
https://www.printables.com/model/708831-rotary-encoder-knob-and-button-parametric
https://www.printables.com/model/278448-fully-parametric-knob-freecad
https://www.printables.com/model/281352-parametric-lcd-knob

Or maybe there are some Blender wizards here on the forum?
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #2 on: January 18, 2024, 03:41:52 pm »
I assumed scaling it would be difficult. If not for the hollow d shaft, I could have scaled this easier.

Maybe the links you provided have the correct size; let me check later.
 

Online themadhippy

  • Super Contributor
  • ***
  • Posts: 2665
  • Country: gb
Re: Resize a STL File For Me
« Reply #3 on: January 18, 2024, 04:02:05 pm »
Quote
I thought to try making one myself on SketchUp, but I wouldn't know how to create the side notches.
sketch up tends to get  things reversed,something to with it modeling faces,not a solid object.On shape is my weapon of choice ,although tinker cad might be an easier option.What id do is double check the d slot size,re scale the model  and then make the d slot the size you want.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #4 on: January 18, 2024, 04:33:50 pm »
Unfortunately I don't exactly have access to a system that allows newer software to work. My old computer still runs XP (long story, but I have lots of expensive software that is costly to update onto a new system and is too old to use with modern revisions of the software), my other is a 32-bit laptop that runs Ubuntu, and normally I use my work laptop that blocks installing software and/or using online sites such as 3D modeling.

The one I've used is SketchUp online (works with Ubuntu 32-bit), and I think it is horrible, however, it has allowed me to make a few designs. Sadly, errors don't show until I generate a STL file and place it in slicing software. At that point blank areas show and will make me realize lots of time was wasted.

If not for the lines on the side of the knob, and wanting it tapered (although I can live with it being cylindrical), I'd design it myself in SketchUp.
 

Online themadhippy

  • Super Contributor
  • ***
  • Posts: 2665
  • Country: gb
Re: Resize a STL File For Me
« Reply #5 on: January 18, 2024, 05:04:23 pm »
this any use as a starting point,no d slot yet as i dont have the dimensions and didnt want to assume.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #6 on: January 18, 2024, 05:52:32 pm »
Quote
It needs to be approx. 13mm height, 18mm diameter at the inside end, 17mm at the outside end, and the inside needs to be 3.15mm hollow before the D part of the hole starts (if this makes sense).

I included the dimensions in my initial message. It doesn't need a line indicator as this knob just spins 360 degrees with the readout on the display.

With the little 3D stuff I've done, I'm curious how one does the lines (?) on the side of the knob. My thought was inserting half circles one at a time, but it seemed to time consuming to be the correct answer.
 

Online themadhippy

  • Super Contributor
  • ***
  • Posts: 2665
  • Country: gb
Re: Resize a STL File For Me
« Reply #7 on: January 18, 2024, 06:10:37 pm »
Quote
I included the dimensions in my initial message
but not that of the d shaped cut out,1 size dont fit all.

Quote
, I'm curious how one does the lines (?) on the side of the knob
one my model i drew the base shape  ,then the top circle and used the loft command.That was in onshape.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12892
Re: Resize a STL File For Me
« Reply #8 on: January 18, 2024, 06:11:38 pm »
These measurements taken from the O.P's original STL, imported at unit 1mm,  may help:
Code: [Select]
stl_h=15.0; // orig. height
stl_d1=22.1; // orig. top dia. (ignoring rounded top edge)
stl_d2=24.6; // orig. base dia.
stl_fr_h=7.0; // orig. inner cone height (to D shaft)
stl_fr_d1=6.13; // orig. inner cone top dia. (at D shaft)
stl_fr_d2=20.2; // orig. inner cone base dia.
stl_shaft_d=stl_fr_d1; // orig D shaft dia
stl_shaft_l=7.15; // orig D shaft length, from cone top
stl_shaft_f=4.8; // orig D shaft thickness at flat
The knob was rotated flat, wide end down before measuring, and was found to be off-center by approx. 0.06mm in X and 0.03mm in Y.

N.B. the O.P. *will* need to tweak the D shaft diameter and thickness at flat for a good fit, as 3D printer's slicer parameters are rarely tuned well enough to produce accurate holes at nominal diameter, without shrinkage.  Its *HARD* to tune the slicer for accurate holes as the shrinkage varies significantly with inner wall curvature, layer height and flow, and filament used.
« Last Edit: January 18, 2024, 06:19:44 pm by Ian.M »
 

Offline Kean

  • Supporter
  • ****
  • Posts: 2124
  • Country: au
  • Embedded systems & IT consultant
    • Kean Electronics
Re: Resize a STL File For Me
« Reply #9 on: January 18, 2024, 06:12:18 pm »
If I import that model into F360, it is huge - nearly 250mm diameter.  Stupid imperial units...

What I would do is to import it into a 3D modelling tool (Fusion 360 typically), convert to a solid model, scale it to required size, add a central axis, and then make an extruded cut sized to the D shaft.  If I was enlarging it, I'd add extra material.

Even better, I would contact the original designer to ask if they have the original 3D CAD file.  Working with STL files, even if converted to a solid model, is an awful experience.

Anyway, I did basically what I described above.  Scaled all to a ratio of 18/250, then measured height at 10.2mm so I scaled in just the Y direction to a ratio of 13/10.2.   Draw a bounding circle to get an approximate centre, and then drew the D shaft hole.  I sized that for a 6.35mm shaft, with the D based on the same ratio as the original.  Not sure if that is correct for you, but see attached - should be a quick print to test.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2555
  • Country: us
Re: Resize a STL File For Me
« Reply #10 on: January 18, 2024, 06:13:03 pm »
Okay
Took a little to cut the scallops.
Not sure of the D-shaft dimensions.

1984765-0

D-cut is 6mm dia with a 3mm wide flat

Edit:  Updated shaft size.  (approx 3.3mm flat)
« Last Edit: January 18, 2024, 06:55:34 pm by MarkF »
 

Offline Kean

  • Supporter
  • ****
  • Posts: 2124
  • Country: au
  • Embedded systems & IT consultant
    • Kean Electronics
Re: Resize a STL File For Me
« Reply #11 on: January 18, 2024, 06:15:00 pm »
With the little 3D stuff I've done, I'm curious how one does the lines (?) on the side of the knob. My thought was inserting half circles one at a time, but it seemed to time consuming to be the correct answer.

Depends on the 3D modelling tool, but in Solidworks or F360 you would draw one of the scallops and then do a circular pattern to repeat it.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2555
  • Country: us
Re: Resize a STL File For Me
« Reply #12 on: January 18, 2024, 06:20:23 pm »
I used FreeCAD to make a smooth knob (blue) and then created an array of half cylinders (pink).
Finally cut the knob body with the array body.


 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #13 on: January 18, 2024, 06:21:40 pm »
Quote
Even better, I would contact the original designer to ask if they have the original 3D CAD file.  Working with STL files, even if converted to a solid model, is an awful experience.

I tried this already, but the person didn't respond.

You're correct, I forgot to include the shaft dimension. It's a 6mm D shaft.

I can take pictures of the good knob tonight and post it.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2555
  • Country: us
Re: Resize a STL File For Me
« Reply #14 on: January 18, 2024, 06:31:51 pm »
I updated previous knob002.zip with new shaft size based on a Google search.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #15 on: January 18, 2024, 06:36:02 pm »
Just an FYI, I've searched many sites for this knob. In a parallel method, I contacted the power supply company (located in China). They can sell replacement parts, however, shipping will be $50 (not including the cost for the parts), so I resorted to searching Thingiverse for a 3D model.

This knob appears to be a custom design/size as most knobs this small are a different shape, have an indicator line, etc...
 

Online themadhippy

  • Super Contributor
  • ***
  • Posts: 2665
  • Country: gb
Re: Resize a STL File For Me
« Reply #16 on: January 18, 2024, 06:36:22 pm »
6x4.5D cutout added
« Last Edit: January 18, 2024, 06:58:40 pm by themadhippy »
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #17 on: January 18, 2024, 06:46:45 pm »
Wow..... thanks.

I don't have the ability to look (or print) it now, but I'll look tonight and try printing this weekend.

The experimental oversized one I printed wasn't very tight on the shaft. Most likely it's my printer, and I can get around this by placing some glue on it. Worst case, if I ever need to remove it, I'll need to cut it, but replacing the rotary encoder isn't difficult. If it gets to the point the knobs need to be removed, then it would mean something is wrong anyway.

Also, another option is I can just scale this model (assuming it works) by an extremely small percentage to reduce the shaft hole.
 

Online themadhippy

  • Super Contributor
  • ***
  • Posts: 2665
  • Country: gb
Re: Resize a STL File For Me
« Reply #18 on: January 18, 2024, 06:58:05 pm »
forget my last post,heres the correct version
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12892
Re: Resize a STL File For Me
« Reply #19 on: January 18, 2024, 07:39:12 pm »
@bostonman

I have managed to rescale your original knob STL using OpenSCAD, filling it in then recutting the interior features to size.   Probably the ugliest part was deriving parameters for the original knob, which was done experimentally and iteratively.

To improve it I'd need actual shaft length from panel (less clearance under knob), actual thickness on flat of D shaft, and desired shaft hole clearance.

Hopefully your laptop has a recent enough Debian to allow you to install OpenSCAD by:
Code: [Select]
sudo apt-get install openscadso you can easily tweak the shaft (and other knob) parameters yourself.

OpenSCAD is basically CAD for programmers.  Here's the script, in all its uglyness:
Code: [Select]
// Fixing up a STL file for EEVblog u:bostonman
// ref: [url]https://www.eevblog.com/forum/3d-printing/resize-a-stl-file-for-me/[/url]

/* [New Knob] */
knob_h=13;
knob_d=18;
shaft_d=6.0;
shaft_f=4.8; // ***best guess***
shaft_l=12; //from knob base, ***best guess***
recess_d1=shaft_d; // recess top dia - make bigger than shaft if flat step wanted
recess_d2=14; // recess base dia
recess_h=3.15;

/* [rendering] */
fill_overlap=0.05; // to guarantee solid
slop=0.1; // increase critical hole diameters by this to print to size
$dd=1e-3; // tolerance for face alignment
$fn=120; // circle rendering facets

/* [Orig. STL] */
stl_h=15.0; // orig. height
stl_d1=22.1; // orig. top dia. (ignoring rounded top edge)
stl_d2=24.6; // orig. base dia.
stl_fr_h=7.0; // orig. inner cone height
stl_fr_d1=6.13; // orig. inner cone top dia. (at D shaft)
stl_fr_d2=20.2; // orig. inner cone base dia.
stl_shaft_d=stl_fr_d1; // orig D shaft dia
stl_shaft_l=7.15; // orig D shaft length, from cone top
stl_shaft_f=4.8; // orig D shaft thickness at flat

// //tweak parametrics to fit the origanal knob
//# cylinder(h=stl_h, d1=stl_d1, d2=stl_d2); // bounding conical frustrum
//# translate([0,0,stl_h-stl_fr_h]) cylinder(h=stl_fr_h,d1=stl_fr_d1,d2=stl_fr_d2); //inner cone
//#translate([0,0,stl_h-stl_fr_h-stl_shaft_l]) dshaft(stl_shaft_l,stl_shaft_d,stl_shaft_f); // d shaft

module dshaft(l,d,f){ //l=length, d=dia, f=thickness at flat
    intersection(){
        cylinder(h=l,d=d);
        translate([0,f-d,l/2]) cube([d,d,l],center=true);
    }
}

module knob_shell(h,d){
    scale([d/stl_d2,d/stl_d2,h/stl_h]){
        translate([0.06,0.03,0]) // it was off-center!
            rotate([90,0,0])
            import("Knob_D_shape_rotary_encoder.stl", convexity=3);
        translate([0,0,stl_h-stl_fr_h-stl_shaft_l-fill_overlap])
            cylinder(h=stl_fr_h+stl_shaft_l+fill_overlap,d1=stl_fr_d1+2*fill_overlap,d2=stl_fr_d2+2*fill_overlap); // infill
    }
}

// render the resized knob
//render()  // only needed (for preview) if graphics driver OpenGL is broken!
difference(){
    knob_shell(knob_h,knob_d); // main object
    // --- cuts ---
    translate([0,0,knob_h-recess_h+$dd])
            cylinder(h=recess_h+$dd, d1=recess_d1, d2=recess_d2); // cone
    translate([0,0,knob_h-shaft_l+$dd])
        dshaft(shaft_l+$dd,shaft_d+slop,shaft_f+slop*shaft_f/shaft_d);
}
[code]
 
The following users thanked this post: Kean

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #20 on: January 19, 2024, 03:08:18 am »
Quote
forget my last post,heres the correct version

I looked at the design and it looks great. I'll try printing it along with the modified one Ian.M posted and see which one is ideal.

Attached is a picture of the good knob.

Update: I'm guessing the 'V' shape hole is a way of getting it to lock onto the shaft. As previously mentioned, I don't really care about this as I'll just glue it. Seeing as how difficult it's been to locate a similar knob, I'm just happy to (hopefully) have a replacement.

« Last Edit: January 19, 2024, 03:29:20 am by bostonman »
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2555
  • Country: us
Re: Resize a STL File For Me
« Reply #21 on: January 19, 2024, 03:54:04 pm »
Not exact.   Close.

1985590-0
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #22 on: January 20, 2024, 03:58:40 am »
I only printed knobd2 so far. It’s basically a perfect diameter, height, etc… but doesn’t fit on the shaft.

If anything, the diameter is slightly smaller, so the X-Y ratio can be increased at my end in the slicing software; maybe by 0.5%. This would benefit the shaft hole.

I’ll work on printing the others this weekend. As for knobd2, besides the shaft hole, the lines on the side could be deeper. This may all be due to my printer having poor resolution, but attached is a comparison.

 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12892
Re: Resize a STL File For Me
« Reply #23 on: January 20, 2024, 04:48:01 am »
Do you have a micrometer, digital or Vernier callipers or other means of measuring small objects accurately? If so it would be worth measuring the shaft diameter, and thickness on the flat before printing more knobs and posting the results here.  Once we have that, we can easily generate a shaft test jig for you, with an array of D holes matching the shaft geometry, but varying from nominal size in steps of 0.05 mm.  It doesn't have to be very thick or large so should be quick to print, though to avoid inaccuracy due to 'elephant's foot' distortion of initial layers, it would be best printed on a raft.  Fit that to the shaft and tell us which over or undersize fits best, and those of us who have contributed models for you can  resize the D hole to best fit your shaft as printed on your printer.

Also, the shaft length measured from the panel, fully  pushed in (i.e. 'click' switch active) would be useful, though that dimension is less critical.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1846
  • Country: us
Re: Resize a STL File For Me
« Reply #24 on: January 20, 2024, 05:13:52 am »
I am measuring with calipers, but, to provide (more) accurate measurements, maybe I should wait for the rotary encoder samples to arrive (Ian.M, I believe you’re part of my other post regarding rotary encoders for my broken power supply) to find out if those will fit and replace the originals. From there, the datasheet will provide accurate measurements eliminating any error on my past.. edit: “part” (typing on my phone and auto correct messed up)

The knob that’s too large was suppose to be a 6mm D shaft (what I searched for and the description stated), and that fit (loosely), so my measurements SHOULD be accurate, but maybe mine are slightly off or my printer has poor resolution. (Anet A8).

Also, when I measured mine, it was 6mm give or take. When I looked online, they came in either 6mm or (I believe) 6.35mm. At that point it was too small to be 6.35 and too large to be anything smaller.
« Last Edit: January 20, 2024, 05:17:35 am by bostonman »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf