Recent Posts

Pages: [1] 2 3 ... 9
1
General Discussion / Re: Planned new features in AngelCAD
« Last post by Carsten Arnholm on 2020-10-13, 15:18:42 »
Some more info of upcoming features

General
"Save & Close all but this" option when right-clicking editor tab.
Linux: Now opening default file browser when opening folder
Now displaying also stderr messages from applications running in thread background (xcsg/openscad)

Search/Replace
Shortcut is now Ctrl+F like most other programs
Search now responds properly to pressing ENTER.

OpenSCAD import
OpenSCADs slightly esoteric options in 'linear_extrude', including twist,scale and slices will be supported. Also extrude with multiple children works.
Allow use of secant_tolerance (a.k.a 'sec_tol') to control discretization of imported models.
Added support for projection(cut=true).
Drag & drop of .scad files into AngelCAD IDE works.
3
General Discussion / Re: Threads - ISO
« Last post by raymw on 2020-09-13, 14:15:35 »
Hi Carsten,
The line in my code ' @mynut= mynut -translate(14,11,0)* cylinder(50,4); //this line'
is from before I used your threading code, I was simply 'drilling' a plain hole, and tapping it when printed. I was thinking it should not be required, as I thought your code removed the core of the thread, but if that line is altered too much, or removed, then the script does not work, It also fails if the depth of countersink (the h values in the cones) is altered or the secant_tolerance value. It becomes a bit of a juggling act. It just happened that my original 12.2 od was OK, but 12.0 od  is not.

So, if you change the value for the diameter of the cylinder in ' //this line' e.g. to 5.35,  (10.7mm being  the tapping drill size for 12mm bolt), it looks OK, change to 5.355 it throws an exception, and I get other errors by altering that value. Comment out that line, then  sometimes it completes OK, sometimes a blank screen, sometimes an image with red. It seems to be almost random behavior.

This type of  problem seems to be getting quite common with what I am doing, and seem to be not too repeatable. If you do not get this happening then either, my installation is faulty, I have pc memory problems, or your version/setup is different than mine.
4
AngelCAD version 1.4-00 was released 28 July 2020, so this post is a belated announcement of that fact. The post is made so that users know about the latest publically available version.

Windows and Ubuntu binaries at
https://github.com/arnholm/angelcad/releases/tag/v1.4-00

Changes in this version
  • fixed missing member functions in spline2d and spline3d. This makes it possible to use spline curves directly in script code.
  • angelcad-samples: fixed segfault error for polygon & polyhedron
  • added new pointcloud to allow reading points from external files. This makes it easier to use external data to make for example a convex hull from a point cloud
  • added dxfread application to read DXF files. This is a stand alone console application that can convert 2d DXF files into an AngelCAD function for use in e.g. linear extrude
  • Windows version now built with MSVC2019. Now using an up to date Windows compiler to Build AngelCAD


5
General Discussion / Re: Planned new features in AngelCAD
« Last post by Carsten Arnholm on 2020-09-13, 09:38:00 »
Some more info on the upcoming features:

Processing of OpenSCAD files
I have now decided to make it easier to use AngelCAD for this purpose. Simply open an OpenSCAD .scad file in the AngelCAD IDE and press the build button. Note that this requires OpenSCAD to be installed on the computer, because it is being used to convert the .scad file to .csg (a fast process even for large models). The benefit is in the much faster processing of the boolean operations in xcsg.  Also, the AngelCAD viewer (AngelView) can then be used in the usual way in this scenario.

Remember which files are open
In version 1.4 or earlier only one file would be remembered and re-opened in the next AngelCAD session. I am working on a feature to remember and restore the complete set of source files that was open in the previous session.

Discovering file edits by other programs
Potentially, a source file opened by AngelCAD could be edited and saved by some other program (e.g. Notepad++) at the same time. In version 1.4 or earlier this would not be discovered by AngelCAD. Work is ongoing to make AngelCAD detect such edits and take proper action.
6
General Discussion / Re: Threads - ISO
« Last post by Carsten Arnholm on 2020-09-13, 09:20:54 »
Here's my code. the '//this line' comment, was left from when I was originally going to tap a plain hole, but if it is removed, or changed to the root diameter, the code fails.

This code as shown seems to run fine. It is not clear to me what '//this line'  is referring to so I am not able to reproduce. Which line number in the script?
7
General Discussion / Threads - ISO
« Last post by raymw on 2020-09-12, 15:34:18 »
I've been recently printing using pet-g. I find it has good mechanical properties for what I want, or at least better than abs or pla. It can be ground, filed and machined, without too many problems. I was thinking of using it for jigs and fixtures, clamps, etc, and was wondering about trying some rule of thumb tests. I designed a T nut, with a 12mm thread. Knowing that holes came out undersize, I changed the od to 12.2, it printed, but still a bit tight on the 12mm stud, so I ran a tap down through. I think the fit could be improved by using a 12mm od thread, as it should be, but I found it would not accept exactly 12mm. I based the code on Carsten's example. Here's my code. the '//this line' comment, was left from when I was originally going to tap a plain hole, but if it is removed, or changed to the root diameter, the code fails. I think, because of the countersinks interacting with the thread ends, it causes confusion in the rendering, changing the secant_tolerance dramatically effects the result.

Code: [Select]
// AngelCAD code.


double to_rad(double deg) { return PI*deg/180.0; } // from degrees to radians


   
   shape2d@ ISO_thread(double Dmaj, double pitch)
{
   double P = pitch;
   // basic thread profile https://en.wikipedia.org/wiki/ISO_metric_screw_thread
   double H = P*cos(to_rad(30));
   double delta = 0.01*P;

   // establish coordinates in profile
   double x1 = delta;;
   double x2 = P/8;
   double x3 = P/2 - P/16;
   double x4 = P/2 + P/16;
   double x5 = P - P/8;
   double x6 = P - delta;

   double y1 = 0;
   double y2 = H/4 - P/16;
   double y3 = H/4;
   double y4 = H - H/8;

   // build the thread profile, points CCW
   pos2d@[] points = { pos2d(x1,y1),  // p0
                       pos2d(x6,y1),  // p1
                       pos2d(x6,y2),  // p2
                       pos2d(x5,y3),  // p3
                       pos2d(x4,y4),  // p4
                       pos2d(x3,y4),  // p5
                       pos2d(x2,y3),  // p6
                       pos2d(x1,y2)   // p7
                     };
   shape2d@ profile = polygon(points);

   // put the profile in place, ready for rotation around Y
   @profile = translate(0.5*Dmaj-H+H/8,P/2)*rotate_z(deg:-90)*profile;

   return profile;
}
   
   
   solid@ ISO_screw(double Dmaj, double pitch)
{
   // EXPERIMENTAL: non-zero pitch and multiple revolutions
   // rotate profile around Y, 13 revolutions, then make it upright
   double revs = 15;
   shape2d@ thread_profile = ISO_thread(Dmaj:Dmaj,pitch:pitch);
   solid@ threads = translate(0,0,pitch*revs)*rotate_x(deg:90)*rotate_extrude(thread_profile,deg:360*revs,pitch:-pitch);

   //make a cylinder inside the threads, then cut the ends by intersecting with a large diameter cylinder

   double H = pitch*cos(to_rad(30));
   double Dmin = Dmaj + 2*(H/8 - H + 0.8*H/4);
   double Rmin = 0.5*Dmin;
   solid@ rod  = cylinder(r:Rmin,h:pitch*revs);
   solid@ screw = intersection3d(union3d(rod,threads),translate(0,0,0.5*pitch)*cylinder(h:pitch*revs*0.9,r:100));

   solid@ cutter = cone(h:pitch*revs*1.3,r1:Dmaj*1.35,r2:1);
   return translate(0,0,-5)*intersection3d(screw,cutter);
}


 
shape@ main_shape()
{
   // t nut with 10mm hole
   solid@ mynut = cuboid(28,22,8);
   @mynut = mynut + translate (0,4,0)*cuboid(28,14,15);
   // hole
   @mynut= mynut -translate(14,11,0)* cylinder(50,4); //this line
   solid@ bolt = ISO_screw(12.05,1.75) ;
  // add countersinks
   solid@ cs = translate(14,11,4)*cone (17.3,0,10);
   solid@ uc =  translate(14,11,-6.3)*cone(17.3,10,0);
   return mynut- translate( 14,11,0)* bolt -cs - uc;
   }
   

 void main()
{
   shape@ obj = main_shape();
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.05);
}
8
General Discussion / Re: console mesages
« Last post by Carsten Arnholm on 2020-09-09, 16:54:16 »
I've not heard of polyfix, but will try it.

Polyfix is part of your angelcad installation, it is a console program. You find it in the same folder as AngelCAD is installed (you also find dxfread there). I recommend you set up the system PATH to include the AngelCAD installation folder.

usage: polyfix [-verbose] [-maxiter <str>] [-dtol <str>] [-atol <str>] [-lumps] [-nflip] [-remesh <str>] [-overwrite]
[-out <str>] [-zip] <input_filename>
 -verbose              Verbose messages
 -maxiter=<str>        [heal]          Max iterations (def=10)
 -dtol=<str>           [heal]          Distance tolerance (def=1.0E-2)
 -atol=<str>           [heal]          Area tolerance (def=1.0E-6)
 -lumps                [heal]          Split into lumps (not supported for stl output)
 -nflip                [heal]          Flip faces with inward normals (experimental)
 -remesh=<str>         [remesh]        Heal & remesh surfaces to given edge length (set dtol to small value ~1.E-6)
 -overwrite            [output]        allow file overwrite, including input file.
 -out=<str>            [output]        output filename/format (.obj, .off, .amf, .stl, .astl)
 -zip                  [output]        save output also to compressed zip file
9
General Discussion / Re: console mesages
« Last post by raymw on 2020-09-09, 16:08:14 »
I've not heard of polyfix, but will try it. Anyway, I found the problem area, and resolved it, but not before I'd produced a print that fell apart when I lifted it from the print bed. (It looked OK in the slicer.)
Code: [Select]
// AngelCAD code.

// makes a spoked handwheel

double bore =8.2;// bore
double shaft=20;//shaft od
double shaftlen=40;//shaft length
double borelen=25;//bore length
double rimod=50;// rim od
double rimid=38;//rim id
double rimthick=8;// rim thickness
double spokes=5;//no of spokes
double fixloc=8;//fix location from boss end
double fixdiam=2;//fix diam
double grips=12;//number of grips
double round =3.5;// diameter of fillet


solid@ rim(double h,double d2,double d1, double rc)
{
// get tube
  solid@ arim= cylinder (h,d2/2) - cylinder(h,d1/2);
//fillet inside
 return arim;
}


solid@ aspoke(double t,double d, double n, double ch)
// get spoke
{
   double thick = (t-ch)*0.5; //spoke width
// make quarter spoke with rounded edge
// use offset, radius ch/2 of square for profile, then extrude
    solid@ spr= linear_extrude(offset2d(square(thick),r:ch/2),(d+(t))/2);
    solid@ spk = translate(0,-(thick/2),thick+ch/2)*rotate_y(90)*spr;
// rotate and add spokes
     array <solid@> total;
     for (int j=1;j<n+1;j++)
     {
        solid@ rotsp = rotate_z(j*360/n)* spk;
        total.push_back(rotsp);
     }
     return union3d(total);
}
 
 solid@ grip(double t,double d, double n)
// puts n balls on circle of diameter d. ball diameter is t
{
  array <solid@> balls;
 
 for (int j=1;j<=n;j++)
   {
    solid@ rotb = rotate_z(j*360/n)*translate(d/2,0,t/2)*sphere((t)*0.8/2);
    balls.push_back(rotb);
   }
   return union3d(balls);
}
 
  shape2d@ corner_poly(double filletdiam,double bigdiameter)
 {
 // generates polygon for rounding corners of tubes
     double  r= filletdiam/2;
     double br= bigdiameter/2;
     shape2d@  block = square(2*r);
     @block = block - translate(0,2*r)*circle(r);
     @block = block - translate(0,0)*circle(r);
     @block = block - translate(2*r,0)*circle(r);
     @block = block - translate(2*r,2*r)*circle(r);
     return translate(br,0)*translate(-r,-r)*block;
     return block;
 }
 
 
 solid@ round_over(double filletdiam, double circlediam)
 {// makes the profile to be subtracted from square ends
    shape2d@ poly = corner_poly(filletdiam,circlediam);
    solid@ curv = rotate_extrude(poly,360,0);
    @curv = rotate_x(90)*translate(0,filletdiam,0)*curv ;
    return translate(0,0,-filletdiam)*curv;
 }
 

 
 solid@ rwboss(double sl,double sd,double bl, double bo,double fixl, double fixd, double ch)
 // calc centre boss with fix hole
{
   solid@ shf=cylinder(sl,sd/2)-translate(0,0, sl-bl)*cylinder( bl, bo/2);
 //fixing  hole
    solid@ fix = rotate_y(90)*cylinder(sd*8,fixd/2);
    return shf  - translate(-sd*3,0,sl-fixl)*fix ;
 

   
shape@ main_shape()
{
  solid@ os=rim(rimthick,rimod,rimid, round);
  solid@ gripper =translate(0,0,0)*grip(rimthick,rimod,grips); 
  // fillet bottom of rim
  @os=os + gripper;
  @os = os - round_over(round,rimod);
  @os = os - round_over(round,rimid);
 
  //fillet top of rim
  @os = os - translate(0,0,rimthick)*round_over(round,rimod);;
  @os = os - translate(0,0,rimthick)*round_over(round,rimid);;
  @os=os + gripper;
// get shaft
   solid@ shft = rwboss(shaftlen,shaft, borelen,bore,fixloc,fixdiam,round);
   @shft= shft -round_over(round,shaft);
// bigger radius at shaft end   
   @shft = shft - translate(0,0,shaftlen)* round_over(round*2,shaft);
// get spokes
  solid@ spk = aspoke(rimthick,rimid,spokes,round);
 
 return os + spk + shft ;
 
}

void main()
{
   shape@ obj = main_shape();
   obj.write_xcsg(GetInputFullPath(),secant_tolerance:.01);
}

The above code works. Previous version  problem was caused by the gripper balls diameter, and the order the handwheel was assembled. If the spheres were big, they did not merge properly with the rounded edge of the rim, and although everything looked fine in meshlab, and on the slicer, it looked good enough to print, but the object was not watertight. The spheres need to be less than the flat area of the rim to be certain it builds correctly, but in some situations they can be a bit larger. I'm pretty sure there are other combinations that fail, too.
10
General Discussion / Re: console mesages
« Last post by Carsten Arnholm on 2020-09-09, 07:07:02 »
run it through polyfix and see if it says anything useful,
Pages: [1] 2 3 ... 9