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 - Dragonfly

Pages: [1] 2 3 ... 9
1
Scripts and Plugin Help / Need help implementing this in Python
« on: January 14, 2025, 17:45:13 pm »
Can someone tell me how to implement the same actions from the VBS example but in Python. The lines colored in Red. Exhausted all ideas I had but no success.
Note: in VB the script works but I need a Python script to work with CB for Linux.

view.SelectAllVisibleGeometry()

    dim newselection as ArrayList = new ArrayList()

    for each ent in view.SelectedEntities
 ........................

    view.Select(newselection.ToArray(GetType(Entity)))   

    view.RefreshView()
----------------------
Hope the forum will hold on for a while  ???

2
Scripts and Plugin Help / How to set layer color in Python
« on: April 05, 2024, 12:35:10 pm »
I can read and print the color of a given layer (Layer.Color) but couldn't hit the right syntax to pass color value (System.Drawing.Color) to change it.
Someone with a clue?

3
CamBam help (General usage) / .STEP import/open
« on: March 18, 2024, 19:27:01 pm »
In the last couple of years almost all the parts I do is from .step files sent to me by the customer. By trial and error I came to a manner of working which suits me well - After opening a .step file I create a new layer called '3d' and set the color to a darker grey shade. Then using the 'select by object type' plugin I select all 3D surfaces and issue 'join' command so that in the new layer I get a single 3D object with the wireframe (a bit lighter) imposed over it.
I know the .step import filter is not fully completed but in the large majority of cases CamBam successfully reads them. Almost without a glitch with the exception of some surfaces not correctly generated while the wirefame is correct, like a filleted hole which has been cut out in the design process.
But yesterday I got a bunch of new .step files and one of them makes CamBam abort the parsing. The file itself is opened in FreeCAD with no complains and I tried reexporting it back to .step format. Again with the same error message. The customer does the design in SolidWorks and I have no means to open its native format.
 
The message I get when trying to open the file is this:
Parsing file...
Extracting objects...
ID:#14392 expected RepresentationItem found BREP_WITH_VOIDS

Is here someone who can cast some light on the meaning of the message?
And, because FreeCAD reads the file OK I suppose some function is not implemented in the import filter of CamBam. (I suspect it may be connected with B-splines but my knowledge is almost zero and this is just a suspicion.)

I cannot share the file as it is under non-disclosure clause. 

4
CamBam help (General usage) / Caution with MOP footer
« on: February 22, 2024, 10:05:09 am »
If you are using MOP footers keep in mind  that CB inserts it before the 'go to clearance' command (?).  Always start the footer with a G0 Zx to lift the tool to a safe height.
I often use a footer to move the tool to some distance on repetitive jobs to assist the removal of a ready part and to put the next one. I know about this 'feature' of CB and always (well almost) place a command to lift the tool first. But sometimes out of absentmindedness I omit that line and the result is a ruined part and/or broken tool.

Can't explain to myself what reason is there to insert the footer code just before the 'go to clearance' command. So be careful.

5
Scripts and Plugin Help / A question to plugin writers - V-cutter pocket
« on: February 11, 2022, 10:50:43 am »
I have a job to engrave a miniature symbol on copper which is then transferred on steel via EDM.
Basically it is a pocket which is done with a V-shaped engraver with 0.1 mm tip and 10 degrees v-angle. With constant depth, i.e. not using V-engrave method. At the same time it provides a draft angle on the walls.
Did a test and it was successful. But I had to resort to another program which can utilize a V-shaped tool.
Looking at the tool paths it's easy to see that what the program does is a standard pocket but with a variable tool diameter.
Given the correct tool geometry - diameter, V-angle, tip width - it is easy to calculate the missing height at the tip, the maximum width of cut at stock zero and width of cut at any consecutive depth. With this data a tool path can be generated for every depth level based on the set DOC per pass and step-over value.

And here is the question: Is it possible to write a plugin for CamBam which will use a pocket MOP but with varying (increasing with depth) tool diameter based on V-engraver geometry? So that on the stock surface the shape corresponds to the geometry.

In theory one could create numerous pocketing MOPs for every depth level by manually calculating the tool diameter relative to stock surface (using an Excel table). But because the depth step for such a tool is a couple of hundredths of a millimeter the task is very time consuming and prone to human errors. Even for a total depth of 0.5-0.6 mm.

My personal programming abilities and CB API  knowledge are limited to writing simple Python scripts. Very insufficient to automate MOP creation, parameter setting and tool path generation.
Thanks.

6
Members Projects / Helical gear
« on: November 01, 2021, 18:00:27 pm »
Because there is a recent thread about involute gear profile creation here I'd like to share some experiense.
Recently a friend asked me whether I could make a new gear to replace the original whose teeth had been smashed by the metal driving worm because the driven shaft go blocked by rust.
It's a vehicle odometer pickup that is mounted on the gearbox. And is a worm drive - a 6 start metal worm rotating a plastic gear on the output shaft.
So the plastic gear has helical teeth. The first obstacle is to correctly determine gear module and teeth angle. And sometimes it is an try and error process.
Next, I generated an involute gear profile, then cut two teeth with the channel between them. Next made an extrusion and placed it on the X/Y plane.
Then I set up a 3D profile MOP limiting the work area by a rectangle. When satisfied by the generated tool paths applied the transformation matrix to the MOP itself rotating it by 15 degrees (the angle taken from the original).
I have a very primitive rotating attachment driven by a worm gear with a backlash the one can feel. But decided to try it. Its axis of rotation is perpendicular to the Y axis.
I had to write a simple kind of post-build processor program in Python which given the diameter of the wheel translates Y-axis movements into angular units and replaces the original G-code. The 'Horizontal method' for the 3D MOP was chosen om purpose because there is a single whole stroke from end to end along the X-axis. And Mach3 (in fact any synchronous movement controller should) takes the burden to synchronize the linear and angular movements so that they finish at the same time and at the same point.
Did the cutting tooth by tooth and moving the angular zero by 22.5 degrees (16 teeth) for every one.  The front end was done on a lathe after that.
Yesterday my friend called me to say that the whole contraption actually worked after assembling. :)
Attached is the .cb file and a photo.

7
CamBam plus feedback / Ruining a part in an optimised manner (rant)
« on: September 13, 2021, 14:04:49 pm »
Dear Mr. Payne,
Andy,
if you happen to read the forum please, do something about 'Optimisation'.

I just had a part ruined due to erroneous tangent lead-in move. On the final finishing pass after an hour of milling.
All because it seems the highest priority of CB is to make the shortest rapid instead of doing a MOP in an uniform and predictable way.
There are two identical parts milled out from a single block of aluminum stock.
I've set the lead-in for the finishing pass to 'Tangent' to minimize tool marks on the surface. Each geometry shape's starting point set identically.
First part (the lower on the picture) finished as expected. Only to be ruined by the tool plunging into its upper left corner for the start of the upper part's pass. Because CB did not respect the starting point and tried to spare about 80 mm of rapid movement.
- If I assign a separate MOP for each part the tool path is correct.
- If I swap the drawing objects order, starting with the upper first, the tool path is correct.
- If I turn optimisation completely off the tool paths are correct.

I understand it's my fault formally for not noticing the wrong lead-in on time. I know there are some bugs and shortcomings in the current CB version.

But IMHO it is absolutely unacceptable to plunge the tool into the area that designates a part.

Same notes apply to pocketing. 'Depth first' does not work with optimisation 0.9.8 and each level starts at different spot. 0.9.7 behaves much better and in a predictable way.

Despite my current state of frustration I'd like to stress that CamBam is a very good and useful product. Offering a lot of flexibility to the user.
What troubles me is the lack of bug and other problems removal updates.

Ivan



8
Scripts and Plugin Help / Select objects by Z level
« on: August 06, 2021, 19:05:44 pm »
Hi folks,
For quite a time now I've been receiving orders for machining parts in the form of simple .DXF files accompanied by a 3D model in .stp file format. CamBam, with some small exceptions, reads the .stp files and it is big bonus as I can see the real part on the screen and plan my work strategy. To make it easier for CamBam I normally 'Select by object type' all 3D surfaces and join them into a single 3D surface on a separate layer. This way I can see the 3D model, the wireframe geometry or both.
There are normally various pockets with different depths often one containing another, holes, posts, etc.
Instead of using the 2D .DXF I started by manually selecting elements from the wireframe, then copying to another layer and joining them them to form closed polylines. This way I have the shapes to be machined at their exact depth. Thus helping me with the creation of 2.5D simple MOPs. If the part is not very complex doing it manually does not consume much time.
Then I thought about automating the process for more complex parts where edges are difficult to separate and select all small segments one by one manually is a time consuming work. I wrote a simple and unsophisticated Python script. The latter brought even more pain to the fact that I am not quite familiar with CB API and methods to access and manipulate entities. Why Python? Because I run CamBam for Linux and Python is the only available language there.
The idea is as follows:
I select a single entity from the wireframe and run the script.
The script determines the Z-level (plane) the entity lies on and by iterating through all (visible) entities copies to a new layer all that lie on the same plane (for now I test only both ends by getting entity's extrema.
After a lot of struggle, reading the reference pages and looking into code snippets it started working with very satisfactory results.

But there is a problem I bumped into: Many of the entities in the wireframe are placed at their places by means of transformation matrix.  For example an arc may lie at 10mm above zero but getting its extrema would read 0 if not in 'Identity'  state. This leads to incorrect selections.
I tried using entity clones and 'ApplyTransformation'  method so there positions read correctly but some of them, especially arcs that lie on X/Z or Y/Z plane cause errors. (I actually do not need them but the iteration process goes through them too).

I am starting this thread in the hope that some of you can give me a hand on how to analyze an entity with active transformation matrix.

If successful the script may come handy to those who use .step models in their work. Speaking in the terms of the expensive CAM packages this is a kind of semi-automatic determination of the 'features' of the model.
I can determine whether the matrix is in 'Identity' state or not but could not find a method to read the actual values and determine the Z component.

Here's the code in its present state
Code: [Select]
# Get the Z level of an object
# iterate through all objects and select objects with
# the same Z level within a tolerance

import sys
#from System import Math
#from System import Array
#from System.Collections.Generic import List
from CamBam.UI import CamBamUI
from CamBam.Geom import *
from CamBam.CAD import *
from CamBam.CAM import *
from CamBam.Geom import *

app.log("Begin")

p3max = Point3F()
p3min = Point3F()
p2 = Point2F(1,1)
tmat = Matrix4x4F
sel = list()
Tlrnc = 0.1 #Tolerance, not used currently
selZ = 0
selminZ = 0
selmaxZ = 0

# First we need one and only one entity selected as a guide
if (view.SelectedEntities.Length == 1):
    for ent in view.Selection:
ne = ent.Clone()
        tmat = ne.Transform
mtrx = ne.Transform.ToString()
if (mtrx != 'Identity'):
if (ne.ApplyTransformation(tmat)):
    mtrx = ne.Transform.ToString()
            else:
                app.log("Could not transform selected ID=" + ne.ID.ToString())
                sys.exit(1)

app.log("Object:  "+ne.ID.ToString())
p3min, p3max = ne.GetExtrema(p3min, p3max,False)
app.log("Extrema:  "+p3min.Z.ToString() + " : " +p3max.Z.ToString())
selZ = p3min.Z
selminZ = selZ - Tlrnc
selmaxZ = selZ + Tlrnc
app.log("Level: "+selZ.ToString() )

nlayer = Layer()
nlayer.Name = "SelLayer"
doc.Layers.Add(nlayer)

#Then iterate throu all
    CamBamUI.MainUI.ActiveView.SelectAllVisibleGeometry()
    for ent in CamBamUI.MainUI.ActiveView.SelectedEntities:
        ne = ent.Clone()
        tmat = ne.Transform
        mtrx = ne.Transform.ToString()
        if (mtrx == 'Identity'):
        p3min, p3max = ne.GetExtrema(p3min, p3max,False)
        if ((p3min.Z >= selminZ) and (p3min.Z <= selmaxZ)) :
        if ((p3max.Z >= selminZ) and  (p3max.Z <= selmaxZ)) :
                nlayer.Entities.Add(ne)
else:
                       sys.exit(1)
# Here must be code to look into the matrix values
                       # No success in doing so
else:
    app.log("Error:  Select a single poly.")


9
I turned off system sounds globally. Linux Ubuntu 18.04.
But CamBam still keeps producing the sounds on error messages or confirmation dialogs.
Is there a way to turn sounds off in CamBam?

10
Members Machines / Chatter
« on: March 19, 2021, 16:49:13 pm »
I came across this very good and revealing (at least for me) video about what happens to tool and material when chatter occurs.
https://youtu.be/aog0syGaZzQ

11
Bug Reports / Not a bug but inconvenience
« on: December 21, 2020, 11:49:47 am »
When there are more than one layer CB treats the one which is the nearest to the root of the layer tree as the topmost layer. I.e. when there are identical or overlapping objects on different layers clicking on a shape selects the one on the topmost layer.
In the same time visualization of the objects is done on the screen in the opposite order - the lowest layer objects are visualized on top of the rest.  So if there are two identical shapes - one colored yellow on the topmost layer and one colored white on the lowest, one sees a white shape but clicking on it actually selects the yellow and makes it active changing the color to what color is set for selected objects.
IMHO this is illogical and needs to be corrected.

As a side note: Many graphic programs have a feature when Ctrl+click selects then next object below the topmost one in case of overlapping objects. Because Ctrl+click is used in CB for adding to selection another combination (or keyboard shortcut) could be used. Or a drop-down menu.

12
Members Projects / Answer to Eddy
« on: December 19, 2020, 14:50:21 pm »
Lime, interesting choice, perhaps you do some carving ?
In order not to derail the laser thread.
Yep, I do some carving. The piece has been cut near the bark so it became visible as an unexpected effect.
Fox on tinted Lime.

13
CamBam plus feedback / Thread milling
« on: August 02, 2020, 17:10:24 pm »
96 holes with M2 thread in brass in < 30 minutes.
Ever since I started using the Thread Mill plugin with thread mill cutters I feel like a new man. :)
I guess I am too conservative with the speeds and could do them faster but do not want to risk the only 0.4 mm pitch cutter I have. Compared to the method with a motorized attachment I made for using ordinary taps it's blindingly fast.

Great plugin!

14
Post Processors (*.cbpp) / Auto clearance
« on: July 25, 2020, 09:10:54 am »
Here's my question:
Is there a way to make the PP place into G-code a calculated value for clearance height. Which will be the sum of general clearance value plus stock surface value. If stock surface is zero the result will be the clearance set for the MOP. If stock surface is >0 then the tool will lift safely enough above it.
The reason I ask is that often I change the stock surface value once referencing the stock top surface, next time - the table top surface. I also often copy/paste ready MOPs but if I forget or miss to change  the clearance value and it is less than stock thickness  the result is most often lethal for the tool. If the PP is able to sum clearance + stock thickness this can be avoided.
I understand it's not an universal solution and there can be many specific cases but in general for my work style it will be an useful feature.

15
CamBam help (General usage) / Shapes ID rnumbering (reordering)
« on: July 17, 2020, 14:18:29 pm »
I think this has been discussed before. Tried the search engine but either because I don't use correct keywords, or the engine is too simple, did not find what I was looking for.
Can someone help with the topic?

In short, I want to renumber a selection of shapes so that their IDs appear in consecutive order. I use the 2D shapes as boundary shapes for 3D operations on a number of 3D objects with a separate 3D Profile for each. My work will speed up if I am able to manually enter shape IDs without looking each time for it in the layer tree. Just by knowing the next number.
Because of other reasons I cannot use nesting but a grid of copied and distributed objects both 3D and flat.

Pages: [1] 2 3 ... 9