Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - matthest

Pages: [1]
1
I downloaded the STEP from this website https://www.newhavendisplay.com/nhd70800480ftcsxvctp-p-9577.html
Converted to .OFF using freecad then imported to angelcad.

solid@ display_no_FPC()
{
    tmatrix@ DISP_OFFSET = translate(0,-200,0);
    tmatrix@ face_out = rotate_x(deg:90);
   
    solid@ s =  Enc().toEdgeTop()*Enc().toCenterZ()*DISP_OFFSET * face_out
                 *(polyhedron("C:/Users/mattis/Documents/OpenSCADLIB/VS/Display - NHD-7.0-800480FT-CSXV-CTP.off"));
   
    return s;
}
void main()
{

   shape@ obj = enclosure() + display_no_FPC();

   obj.write_xcsg(GetInputFullPath(),secant_tolerance:0.005);
}


I get the error
xcsg finished with exception: (carve error): D:\cpde_3rdparty\msvclibs\carve\lib
If i change the line:
tmatrix@ DISP_OFFSET = translate(0,-200,0); =>     tmatrix@ DISP_OFFSET = translate(0,-100,0);
then the error disappears. Any idea what the problem is?

2
General Discussion / Color changes in Anglecad
« on: 2020-06-07, 16:20:05 »
Hi.
I am wondering, is it possible to change the colors on AngelView, e.g White edges on blue background?
Can I change it without compiling a new version of AngelView?

3
Hi. Wondering if there is some sort of best practice for adding several solids on top of each other.

I have an example with three solids made out of sinusoidal functions called circle_bottom(), circle_middle(), and circle_top().
Having added them in a sum "return circle_bottom()+ circle_top()" works, but "return circle_bottom()+ circle_top() + circle_middle();" removes the first two solids.

I get some warnings etc, but I am nut sure how to debug:
Code: [Select]
Warning: Polyhedron is not water-tight, it has 8 edges, 8 with wrong use count, 8 with use-count==1
https://imgur.com/LPWtILJ
https://imgur.com/X36oa4V

Code: [Select]
// AngelCAD sample: vase_with_handle.as
// This example demonstrates use of sweep
#include "circlemaker.h"



shape@ main_shape()
{
   // scale down for web visualisation
   return circle_bottom()+ circle_top() + circle_middle();
}

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


Code: [Select]
solid@ circle_middle()
{
   
   shape2d@ prof = circle(r:2);
   pos3d@[] p;
   vec3d@[] v;
   double dt = 10.0;
   double ds = 2*PI/40;
   double alpha = 0;
   
   double x_; // new x value after movement
   double z_; // new z value after movement
   
   for(uint i=0; i<21; i++) {
      double x= 40*sin(i*ds);
      double y = 40*cos(i*ds);
      double z = 40*(-cos(2*PI*x/(40*4)));
     
      double hypotenus =x;
      if(x != 0){
         alpha = atan(z/x);
         print("x="+x);
         print("\n");
         print("z="+z);
         print("\n");
         x_ = hypotenus*cos(alpha);
         z_ = hypotenus*sin(alpha);
         print("x' = "+x_);
         print("\n");
         print("z' = "+z_);
         print("\n");
         print("alpha="+alpha/(2*PI)*360+" degrees");
         print("\n\r");

      }
      else{
         alpha = 0;
         print("x="+x);
         print("\n");
         print("z="+z);
         print("\n");
         x_ = hypotenus*cos(alpha);
         z_ = hypotenus*sin(alpha);
         print("x' = "+x_);
         print("\n");
         print("z' = "+z_);
         print("\n");
         print("alpha="+alpha/(2*PI)*360+" degrees");
         print("\n\r");
      }
     
     
      p.push_back(
         pos3d(x_, y, z_)
         ); // straight line
      v.push_back(vec3d(1,0,0));   // sine curve radius
   }

   spline_path@ path = spline_path(p,v);
   return sweep(prof,path);
}

solid@ circle_top()
{
   
   shape2d@ prof = circle(r:2);
   pos3d@[] p;
   vec3d@[] v;
   double dt = 10.0;
   double ds = 2*PI/40;
   double alpha = 0;
   double x_; // new x value after movement
   double z_; // new z value after movement
   
   for(uint i=0; i<21; i++) {
      double x= 40*sin(i*ds);

      double y = 40*cos(i*ds);
      double z = 40+40*(-cos(2*PI*x/(40*4)));
      double hypotenus =x;
      if(x != 0){
         alpha = atan(z/x);
         print("x="+x);
         print("\n");
         print("z="+z);
         print("\n");
         x_ = hypotenus*cos(alpha);
         z_ = hypotenus*sin(alpha);
         print("x' = "+x_);
         print("\n");
         print("z' = "+z_);
         print("\n");
         print("alpha="+alpha/(2*PI)*360+" degrees");
         print("\n\r");

      }
      else{
         alpha = 0;
         print("x="+x);
         print("\n");
         print("z="+z);
         print("\n");
         x_ = hypotenus*cos(alpha);
         z_ = hypotenus*sin(alpha);
         print("x' = "+x_);
         print("\n");
         print("z' = "+z_);
         print("\n");
         print("alpha="+alpha/(2*PI)*360+" degrees");
         print("\n\r");
      }
     
     
      p.push_back(
         pos3d(x_, y, z_)
         ); // straight line
      v.push_back(vec3d(1,0,0));   // sine curve radius
   }

   spline_path@ path = spline_path(p,v);
   return sweep(prof,path);
}


solid@ circle_bottom()
{
   shape2d@ prof = circle(r:2);
   pos3d@[] p;
   vec3d@[] v;
   double dt = 10.0;
   double ds = 2*PI/40;
   
   for(uint i=0; i<21; i++) {
      p.push_back(pos3d(40*sin(i*ds),40*cos(i*ds),0)); // straight line
      v.push_back(vec3d(1,0,0));   // sine curve radius
   }

   spline_path@ path = spline_path(p,v);
   return sweep(prof,path);
}

Pages: [1]