### Re: Need help creating a design similar with the pictures

SP
Sanjeev Prabhakar
Mon, May 9, 2022 10:15 AM

Idea is in this code:

sec=m_points_so(cr(pts1([[0,10],[0,5],[12,0,5],[10,-5],[23,0]]),5),20,.1);
max_x=max(sec*[1,0]);
p_line(sec,.1);
echo(max_x);

sec1=[for(i=[0:len(sec)-1])[13cos(sec[i].x/max_x360),13sin(sec[i].x/max_x360),sec[i].y]];
sec2=[for(i=[0:len(sec)-1])[10cos(sec[i].x/max_x360),10sin(sec[i].x/max_x360),sec[i].y]];

sec3=cpo([sec1,sec2]);

surf_base(sec3);

On Mon, 9 May 2022 at 06:01, sorin vatasoiu via Discuss <

---------- Forwarded message ----------
From: sorin vatasoiu svatasoiu@yahoo.com
Cc:
Bcc:
Date: Mon, 9 May 2022 00:31:07 +0000 (UTC)
Subject: [OpenSCAD] Need help creating a design similar with the pictures
Hi,

I'm trying to simulate this knob. I can handle everything but the circular
side with a channel on it.

I can do the flat circular side with the channel, but I cannot figure out
how to do the halt side that has an inclination.
the code I have for the side part it is:

\$fn = 360;

outsideChannelFlat();
//channelProfile();

module outsideChannelFlat(){
rotate_extrude(angle = 180, convexity = 2) {
translate([57.5/2,0,0])
channelProfile();
}
}

module channelProfile(){
difference(){
square([7.2,16.5],center = false);
translate([7.2/2,16.5,0])
circle(\$fn = 180,  r = 4.5/2);
}
}

Any help with the inclined part it is welcomed.

Thank you,

Sorin

---------- Forwarded message ----------
From: sorin vatasoiu via Discuss discuss@lists.openscad.org
Cc: sorin vatasoiu svatasoiu@yahoo.com
Bcc:
Date: Mon, 9 May 2022 00:31:07 +0000 (UTC)
Subject: [OpenSCAD] Need help creating a design similar with the pictures

To unsubscribe send an email to discuss-leave@lists.openscad.org

SP
Sanjeev Prabhakar
Mon, May 9, 2022 3:55 PM

code is here:

sec=m_points_so(cr(pts1([[0,10],[0,5],[12,0,5],[10,-5],[23,0]]),5),40,.1);
max_x=max(sec*[1,0]);
//p_line(sec,.1);
echo(max_x);

sec1=[for(i=[0:len(sec)-1])[13cos(sec[i].x/max_x360),13sin(sec[i].x/max_x360),sec[i].y]];
sec2=[for(i=[0:len(sec)-1])[10cos(sec[i].x/max_x360),10sin(sec[i].x/max_x360),sec[i].y]];

sec3=cpo([sec1,sec2]);

sec4=loop(sec,44,131);

//p_lineo(sec4);

path=[for(i=[0:len(sec4)-1])[11.5cos(sec4[i].x/max_x360),11.5sin(sec4[i].x/max_x360),sec4[i].y]];
sec5=cir(.8,s=30);

prism=[for(i=[0:len(path)-2])let(
i_plus=i+1,
p0=path[i],
p1=path[i_plus],
v1=p1-p0,
v2=[p0.x,p0.y],
a1=ang(norm([v1.x,v1.y]),v1.z),
a2=ang(v2.x,v2.y)+90,
ang1=is_num(a1)?a1:0,
ang2=is_num(a2)?a2:0,
sec=q_rot(["x90","z-90"],sec5),
a_sec=trns(p0,q_rot([str("y",ang1),str("z",ang2)],sec))
)a_sec];
render()
difference(){
surf_base(sec3);
swp(prism);}

On Mon, 9 May 2022 at 15:45, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

Idea is in this code:

sec=m_points_so(cr(pts1([[0,10],[0,5],[12,0,5],[10,-5],[23,0]]),5),20,.1);
max_x=max(sec*[1,0]);
p_line(sec,.1);
echo(max_x);

sec1=[for(i=[0:len(sec)-1])[13cos(sec[i].x/max_x360),13sin(sec[i].x/max_x360),sec[i].y]];

sec2=[for(i=[0:len(sec)-1])[10cos(sec[i].x/max_x360),10sin(sec[i].x/max_x360),sec[i].y]];

sec3=cpo([sec1,sec2]);

surf_base(sec3);

On Mon, 9 May 2022 at 06:01, sorin vatasoiu via Discuss <

---------- Forwarded message ----------
From: sorin vatasoiu svatasoiu@yahoo.com
Cc:
Bcc:
Date: Mon, 9 May 2022 00:31:07 +0000 (UTC)
Subject: [OpenSCAD] Need help creating a design similar with the pictures
Hi,

I'm trying to simulate this knob. I can handle everything but the
circular side with a channel on it.

I can do the flat circular side with the channel, but I cannot figure out
how to do the halt side that has an inclination.
the code I have for the side part it is:

\$fn = 360;

outsideChannelFlat();
//channelProfile();

module outsideChannelFlat(){
rotate_extrude(angle = 180, convexity = 2) {
translate([57.5/2,0,0])
channelProfile();
}
}

module channelProfile(){
difference(){
square([7.2,16.5],center = false);
translate([7.2/2,16.5,0])
circle(\$fn = 180,  r = 4.5/2);
}
}

Any help with the inclined part it is welcomed.

Thank you,

Sorin

---------- Forwarded message ----------
From: sorin vatasoiu via Discuss discuss@lists.openscad.org
Cc: sorin vatasoiu svatasoiu@yahoo.com
Bcc:
Date: Mon, 9 May 2022 00:31:07 +0000 (UTC)
Subject: [OpenSCAD] Need help creating a design similar with the pictures

To unsubscribe send an email to discuss-leave@lists.openscad.org

SP
Sanjeev Prabhakar
Mon, May 9, 2022 4:04 PM

replace last difference command with following to avoid rendering issues:

difference(){
surf_base(flip(sec3));
swp(flip(prism));}

On Mon, 9 May 2022 at 21:25, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

code is here:

sec=m_points_so(cr(pts1([[0,10],[0,5],[12,0,5],[10,-5],[23,0]]),5),40,.1);
max_x=max(sec*[1,0]);
//p_line(sec,.1);
echo(max_x);

sec1=[for(i=[0:len(sec)-1])[13cos(sec[i].x/max_x360),13sin(sec[i].x/max_x360),sec[i].y]];

sec2=[for(i=[0:len(sec)-1])[10cos(sec[i].x/max_x360),10sin(sec[i].x/max_x360),sec[i].y]];

sec3=cpo([sec1,sec2]);

sec4=loop(sec,44,131);

//p_lineo(sec4);

path=[for(i=[0:len(sec4)-1])[11.5cos(sec4[i].x/max_x360),11.5sin(sec4[i].x/max_x360),sec4[i].y]];
sec5=cir(.8,s=30);

prism=[for(i=[0:len(path)-2])let(
i_plus=i+1,
p0=path[i],
p1=path[i_plus],
v1=p1-p0,
v2=[p0.x,p0.y],
a1=ang(norm([v1.x,v1.y]),v1.z),
a2=ang(v2.x,v2.y)+90,
ang1=is_num(a1)?a1:0,
ang2=is_num(a2)?a2:0,
sec=q_rot(["x90","z-90"],sec5),
a_sec=trns(p0,q_rot([str("y",ang1),str("z",ang2)],sec))
)a_sec];
render()
difference(){
surf_base(sec3);
swp(prism);}

On Mon, 9 May 2022 at 15:45, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

Idea is in this code:

sec=m_points_so(cr(pts1([[0,10],[0,5],[12,0,5],[10,-5],[23,0]]),5),20,.1);
max_x=max(sec*[1,0]);
p_line(sec,.1);
echo(max_x);

sec1=[for(i=[0:len(sec)-1])[13cos(sec[i].x/max_x360),13sin(sec[i].x/max_x360),sec[i].y]];

sec2=[for(i=[0:len(sec)-1])[10cos(sec[i].x/max_x360),10sin(sec[i].x/max_x360),sec[i].y]];

sec3=cpo([sec1,sec2]);

surf_base(sec3);

On Mon, 9 May 2022 at 06:01, sorin vatasoiu via Discuss <

---------- Forwarded message ----------
From: sorin vatasoiu svatasoiu@yahoo.com
Cc:
Bcc:
Date: Mon, 9 May 2022 00:31:07 +0000 (UTC)
Subject: [OpenSCAD] Need help creating a design similar with the pictures
Hi,

I'm trying to simulate this knob. I can handle everything but the
circular side with a channel on it.

I can do the flat circular side with the channel, but I cannot figure
out how to do the halt side that has an inclination.
the code I have for the side part it is:

\$fn = 360;

outsideChannelFlat();
//channelProfile();

module outsideChannelFlat(){
rotate_extrude(angle = 180, convexity = 2) {
translate([57.5/2,0,0])
channelProfile();
}
}

module channelProfile(){
difference(){
square([7.2,16.5],center = false);
translate([7.2/2,16.5,0])
circle(\$fn = 180,  r = 4.5/2);
}
}

Any help with the inclined part it is welcomed.

Thank you,

Sorin

---------- Forwarded message ----------
From: sorin vatasoiu via Discuss discuss@lists.openscad.org