Author Topic: create an stl file  (Read 44672 times)

Offline 10bulls

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 2163
  • Coding Jedi
    • View Profile
    • www.cambam.info
Re: create an stl file
« Reply #15 on: April 10, 2020, 07:52:17 am »
I just attached a new version of the drawing in my previous post... the original had a couple of inverted faces.

In scripts like manual_surfaces. script (165), there are lines like...

Code: [Select]
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([138,80,136,96],True))

The last parameters : 'invert' (True/False) inverts the generated surface.

SurfaceFiller.PlaneFillPolylineSegs is one of the helper scripts that takes an array of polyline IDs that form a boundary, then fills it.
The function assumes all the segments are contained within the same plane.
Functions like this will get absorbed into the core CamBam functionality soon.

Offline 10bulls

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 2163
  • Coding Jedi
    • View Profile
    • www.cambam.info
Re: create an stl file
« Reply #16 on: April 10, 2020, 08:06:34 am »
Andy,

In light of what you said, I think the best way forward for CamBam would be to implement a system like Grasshopper for Rhino.
It is in fact almost there when you take script entities into account.
Looks interesting... similar to Blender's shader definitions.

One thing coming soon that should make life easier is the addition of 'Inputs A', 'Inputs B' properties to scripts that will be similar to the 'Primitive IDs' property of machining operations.  This way people can use a common library of scripts without having to bother with the details of the script itself.
Subtract all shapes in 'Inputs B' from shapes in 'Inputs A' for example.
... or from this drawing: PlaneFill boundary formed by shapes in 'Inputs A'.
The inputs list also needs to be improved to support layer names as well as sub-objects (select an individual polyline segment for example).

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5333
  • Made in England
    • View Profile
Re: create an stl file
« Reply #17 on: April 10, 2020, 08:47:06 am »
I think it's much bigger than the Blender stuff and amazingly you go on to describe A and B inputs which is exactly the fundamentals of Grasshopper.
Take a look at these very basic videos and you will see it's the way forward.
https://vimeopro.com/rhino/grasshopper-getting-started-by-david-rutten
« Last Edit: April 10, 2020, 08:50:59 am by EddyCurrent »
Filmed in Supermarionation

Offline michel

  • Wookie
  • ****
  • Posts: 263
    • View Profile
    • het-trappenatelier
Re: create an stl file
« Reply #18 on: April 10, 2020, 10:32:35 am »
Hi Andy,

Looks great !! So if I have to make other shapes can I just use this file and enter other shapes in the layers scr-top, stringer and step with an import dxf and run the scripts ?

regards
Michel


Offline 10bulls

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 2163
  • Coding Jedi
    • View Profile
    • www.cambam.info
Re: create an stl file
« Reply #19 on: April 10, 2020, 11:37:13 am »
Looks great !! So if I have to make other shapes can I just use this file and enter other shapes in the layers scr-top, stringer and step with an import dxf and run the scripts ?

Sort of, here are some general guidelines...

'src-top' layer
The script in the top of the drawing contains two lines...
Code: [Select]
arc1 = doc.FindPrimitive(60)
arc2 = doc.FindPrimitive(58)
So if those two arcs get replaced, the IDs will also need to be updated in the script.
It may be easier just to hard code in the radius like this...
Code: [Select]
radius1 = 212.5
radius2 = 157.5
Then the 'src-top' layer isn't needed at all and can just be used for reference.

'stringer' layer
Each edge segment must be a single polyline.  I did this by using edit 'explode' on your source drawing, selecting all the shapes in one edge, then using edit join.
...or just ctrl+p to turn the line segments back into polylines.

The left hand edge needs to be aligned on the Y axis.  The Transform - Move command (CTRL+M) is handy for this.  If you hold down the CTRL key when selecting the source points you can select 2 source points on one edge, then line them up when selecting destination points.

'step' layer
Again, each edge segment must be a single polyline.

I also needed to trim the lower step that you had drawn overlapping the stringer shape.

wrap_edges and surface_wraps
These should automatically update if the top level script changes or when the document is reopened.
Otherwise you can highlight all the scripts and press 'F5' to update.

I have just added a script as the first object in the drawing tree, with 'Execute on Update' set 'False' and code...
Code: [Select]
doc.UpdateChildScripts(True)
Selecting this script and pressing F5 will then refresh all the scripts in the drawing.

Now things get a bit more tedious sorry!

'wrap_edges_exploded'
Select the script in 'explode_wrap_edges_F5' layer and press 'F5'.
This will replace all the edges in the 'wrap_edges_exploded' layer with the recalculated edges from 'wrap_edges'

Unfortunately, this means all the following scripts that used the IDs of these edges will now need to be manually updated.
There are also 4 line segments in layer 'manual_edge_draw' that will need to be updated.
Probably easier just to double click the existing ones and drag the end points to the updated positions.
(I was planning to automate those but ran out of time)

'manual_surfaces' layer

The first script in this layer (script 165) has the following code
(I've added some comments to identity which sections do what)
Code: [Select]
# top step pocket edges
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([134,78,133,94],False))
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([133,81,138,97],True))
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([138,80,136,96],True))

# middle step pocket edges
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([82,141,98,142],True))
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([141,85,146,101],True))
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([146,84,144,100],True))
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([144,83,142,99],True))

# bottom step pocket edges
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([150,86,149,102],False))
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([154,92,152,116],True))
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([152,87,150,103],True))

# left hand edge
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([158,170,134,95,136,171,159,132],True))
# right hand edge
this.Entities.Add(SurfaceFiller.PlaneFillPolylineSegs([157,131,160,169,154,124,149,168],True))

The numbers are the IDs of the polylines that make up the boundaries of those faces.
I found it easier to have a copy of the script open in another program (such as notepad), then click on the edges in the drawing for each boundary and type in the ID
into the corresponding script.

If a surface looks grey, you may need to reverse the True/False parameter to invert that surface.

The other two scripts in this layer create the top and bottom swept surfaces.

The code for the top one is...
Code: [Select]

# front edge
polyA = doc.FindPrimitive(125)
# rear edge
polyB = doc.FindPrimitive(129)

this.Entities.Add(SurfaceFiller.BridgeFillPolylines(polyA,polyB,True))

'all_surfaces' layer

Once all the manual surfaces have been updated, you can refresh the script in this layer.
Hide all the layers other than this one, then export the file to an STL.




Offline michel

  • Wookie
  • ****
  • Posts: 263
    • View Profile
    • het-trappenatelier
Re: create an stl file
« Reply #20 on: April 10, 2020, 22:51:03 pm »
Hi Andy

Thanks a lot, it works and indeed what a work on these faces. An automation would be very welcome.
So I think I managed this new one but why is my shape so distant from my 2d Dxf? In your file, they were much closer together. Did I align in the wrong way?

regards
Michel

Offline 10bulls

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 2163
  • Coding Jedi
    • View Profile
    • www.cambam.info
Re: create an stl file
« Reply #21 on: April 11, 2020, 07:45:16 am »
Thanks a lot, it works and indeed what a work on these faces. An automation would be very welcome.
I have a version working with the development version of CamBam that I may be able to adapt to V1 that reduces some steps.

Quote
So I think I managed this new one but why is my shape so distant from my 2d Dxf? In your file, they were much closer together. Did I align in the wrong way?
The shape is wrapped around the Y axis, which becomes the center of the cylinder.
In your first drawing the outer radius was ~250mm.  In this one it is ~900mm, so the result is much further away from the axis.

I spotted another problem with this method.  The CamBam surface join function in V1/0.98 is not very smart and only tries to connect common vertices,
so the edges are not completely connected.  I am working towards getting a CamBam V1.1 development release ready that will fix this problem (and make the whole process easier).

Offline michel

  • Wookie
  • ****
  • Posts: 263
    • View Profile
    • het-trappenatelier
Re: create an stl file
« Reply #22 on: April 11, 2020, 14:17:17 pm »
Hi,

I created both stringers I needed an exported them in 2 different ways . 1 as DXF and 2 as STL. ( just to see the results )

the issue now is that my cad program opens the dxf but the seems to be no content and opening the stl file that I made with cambam cannot be open for example in Sketchup ?? Can someone tell me if my files are correct?

The stl files can be reopened in cambam but the dxf is also given no content if reopened in cambam.


regards
Michel

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3383
    • View Profile
Re: create an stl file
« Reply #23 on: April 11, 2020, 18:25:13 pm »
I have run in to the same problem, so I use ViaCad for this. Hopefully this will help you. Imported both CB stl files to ViaCad and exported them as stl.   
« Last Edit: April 11, 2020, 20:23:38 pm by Bubba »
My 2ยข

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7597
    • View Profile
    • Cambam V1.0 French Doc
Re: create an stl file
« Reply #24 on: April 11, 2020, 22:26:46 pm »
Hello

I tried your 2 STL on SolidWorks, 3D Studio Max, MeshLab and Simplify3D, and no problem for open. Only SW complain about some defects for stl2, but it open the file.

Maybe you can try to use MeshLab to do the same as Bubba.

Also, maybe Sketchup is not the better 3D software  :'( .... as free 3D software , did you tried FreeCAD ?

++
David
« Last Edit: April 11, 2020, 22:31:49 pm by dh42 »

Offline michel

  • Wookie
  • ****
  • Posts: 263
    • View Profile
    • het-trappenatelier
Re: create an stl file
« Reply #25 on: April 14, 2020, 10:01:38 am »
Hi ,

The stl files have been approved for machining  ;D. This will be done this Friday . I wil provide some pictures once done.

I am still looking to get hese processed as stp file in the future. Is there any way to transform an stl into a step file ?

regards
Michel

Offline michel

  • Wookie
  • ****
  • Posts: 263
    • View Profile
    • het-trappenatelier
Re: create an stl file
« Reply #26 on: April 16, 2020, 11:00:21 am »
Hi,

The 2 files are in process for machining but there was an issue with 1 file. They managed to convert the first file easily to a solid and transform it into an STP file but the other file needed some work because it was not possible to transform it into a solid. The information I got was that there only needs to be 1 bad connection in the drawing to create that problem. If I look at the file on the edge side where the 2 steps need to cut through the side, the face is completely closed without showing the step cutouts. When turning the object in the other way and you look from the step-side it is open. I checked all the boundaries and I cannot find why the shape remains closed and this could be the issue they have with it.

Can someone spot the issue on this one?


regards
Michel

Offline 10bulls

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 2163
  • Coding Jedi
    • View Profile
    • www.cambam.info
Re: create an stl file
« Reply #27 on: April 16, 2020, 13:34:18 pm »
Try this one...

There was a boundary line (ID=170), where the top point did not quite match up with the corner.

Offline 10bulls

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 2163
  • Coding Jedi
    • View Profile
    • www.cambam.info
Re: create an stl file
« Reply #28 on: April 16, 2020, 15:30:29 pm »
I am still working on getting a CamBam V1.1 development release ready, which should make your life easier.

With this you can create the main stringer block as one surface, the steps as another, then subtract the steps from the main block.
Everything is driven from the stringer and step oultline drawings, so no manual steps needed.
The resulting solid is also a nice manifold, which should keep most CAD programs happy.

I have attached a manifold STL created from your previous drawing using V1.1, in case there are any problems loading the other one.

STEP exporting is a little way off, but will be added eventually.

If testing goes to plan, I'll aim to get an early V1.1 preview release out next week.

Offline michel

  • Wookie
  • ****
  • Posts: 263
    • View Profile
    • het-trappenatelier
Re: create an stl file
« Reply #29 on: April 16, 2020, 15:49:58 pm »
Hi Andy,

thanks a lot. I will send it out for testing and let you know the result.



regards
Michel