CamBam
News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 09, 2018, 19:47:40 pm


Login with username, password and session length


Pages: [1] 2 3 4
  Print  
Author Topic: FreeCAD WorkBench to import CBfiles  (Read 2555 times)
onekk
Wookie
****
Offline Offline

Posts: 403


View Profile
« on: October 06, 2018, 10:53:42 am »

Hi to all I put here the new files.

It seem's it more taylore to have here:

Some correction on code and some improvement:

1) text files are not finished yet

2) the transformation matrix is not supported yet

3) mesh aren't supported yet

REgards

Carlo D.


* OneCAM-beta_3.zip (25.73 KB - downloaded 19 times.)
Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3692



View Profile
« Reply #1 on: October 06, 2018, 15:16:31 pm »


Now I'm searching for a code that return me the CW and CCW giving the costruction point of the polylines (and rectangles that internally hold the polylines too)

Regards

Carlo D.


Have a look here; http://www.cambam.info/doc/api/Polyline.htm


test cb file loaded okay, see attached image


* Image1.jpg (168.07 KB, 1000x1474 - viewed 37 times.)
« Last Edit: October 06, 2018, 15:21:08 pm by EddyCurrent » Logged
onekk
Wookie
****
Offline Offline

Posts: 403


View Profile
« Reply #2 on: October 07, 2018, 01:16:27 am »

OK i have to investigate the API.

Thanks

Carlo D.
Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
dave benson
CNC Jedi
*****
Offline Offline

Posts: 1017


View Profile
« Reply #3 on: October 07, 2018, 02:09:28 am »

Hi Carlo

I tested the file and geometry,by making the primitives required by the various workbenches.

All the tests worked and I was able to make 3d objects from the imported geometry.

With the text I found that there is a setting in the panel to change the behavior of the text in the view.
either 2D or 3D.
There's a difference between an Annotation text and a Label text.
All in All it's going very well.
Dave

Logged
onekk
Wookie
****
Offline Offline

Posts: 403


View Profile
« Reply #4 on: October 08, 2018, 11:39:33 am »

Hi dave benson

In fact the text in FC is of two types, Annotations, (which iapparently didn't scale with the image)

The Shapestring (which I'm inclined to use as it retain the size you gave at the creation), but there are some question to answer:

- The font in CamBam, is used mainly for annotations (or maybe I'm wrong?) when I use for other thing, I transform the text in a polyline, maybe using outline for cutting out from wood.

I have not used yet the engrave MOP (if I remember well this is the other use of a text "as is" in CamBam)

- The font path in Linux and Windows are different so a manner to manipulate them is needed,
This problem aplly also to the font name and style (as in Linux there are many variant, other than Bold, italic and "regular")

The Shapestring is a shape so it is possible to obtain a bounding box and so make the created text respect the alignement property of CamBam, but this create a shape (a solid of 0 height, if I'm starting to learn FreeCAD properly)

What text we have to use? more research are needed or maybe some hints are required from future users of this "little piece of software".

As I haven't used yet the engrave MOP "porting" the text in FC is marginal, so the "translation" problems are not very  high in my TODO list.

But suggestion are very welcomed.

As a side note, I've sorted out a manner to fill the CCW and CW property using some math testing the "order" of the first three points using a numpy matrix and a formula found on WikiPedia https://en.wikipedia.org/wiki/Curve_orientation#Orientation_of_a_simple_polygon

And it seems almost correct, but for at least three points, for two point maybe a simple test x0-x1 and y0-y1 is sufficient.

Regards

Carlo D.
 
Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3692



View Profile
« Reply #5 on: October 08, 2018, 14:15:41 pm »

Can you please confirm that these are the steps required;

1. start FreeCAD
2. from the drop down that says "Start" select "OneCAM"
3. three icons appear, select icon "Load a CamBam File to process"
4. choose the test file called "test_obj.cb"
5. select icon, "Import All CB Entities to FC"
6. the entities appear.
Logged
pixelmaker
CNC Jedi
*****
Offline Offline

Posts: 1653


View Profile WWW
« Reply #6 on: October 08, 2018, 20:16:34 pm »

I tried to get OneCAM to work today.
The working environment appears, I can select it, but when I select it I only get an error message:

PySide2.QtWidgets.QHeaderView' object has no attribute 'setResizeMode'

I can't see any buttons, I canĀ“t do anything with the workbench.

mac osx 10.11.6, FreeCAD 0.17

ralf


* Bildschirmfoto 2018-10-08 um 17.55.33.png (25.67 KB, 420x158 - viewed 27 times.)
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3692



View Profile
« Reply #7 on: October 08, 2018, 20:40:41 pm »

Ralf,

I believe the error refers to the Qt cross platform SDK that is used with FreeCAD.

I'm using Windows so this is just a guess at how the mac looks.

In the "OneCAM-FreeCAD" folder there is a file called "OCB_Gui.py" and in there you should find two instances of, "setResizeMode". If you can use an editor such as Notepad++, change those two instances to, "setSectionResizeMode", save the file then try to restart FreeCAD.

On my system, "setResizeMode" works but "setSectionResizeMode" does not  Huh

If you search the net for "setSectionResizeMode" and "setResizeMode" more information will come to light, it seems one of those is an old function and it depends upon the version of Qt installed.

In FreeCAD if you go to, Help->About->Libraries, it will show the version of Qt, mine is Qt 4.8.7 if your is Qt 5 then that may explain it.


* error.jpg (29.89 KB, 942x248 - viewed 22 times.)
« Last Edit: October 08, 2018, 20:51:43 pm by EddyCurrent » Logged
onekk
Wookie
****
Offline Offline

Posts: 403


View Profile
« Reply #8 on: October 08, 2018, 22:36:39 pm »

Hi to all.


For pixelmaker  FreeCAD 0.17 use the Qt 4.8 and not the Qt5.0 at least on Linux and I suppose Windows, PySide2 is Qt5 specific.

Maybe Mac OS use the Qt5 even for the 0.17 (That at lest in Linux is Python2 and Qt 4.8 based).

Mac OS with FreeCAD has much problems than Linux and Windows, as many post on the FreeCAD Forum seems to reveal.

EddyCurrent the expected behaviour of OneCAM is those you described, the plus button on the toolbar will "translate" the selected CamBam entity in one "new" group named "default" (sorry for the lack of originality) despite the original layer name and permit to copy many time the same entity, modifying the "object" name accordingly (trying to guess the name that FC has assigned to avoid name conflict).

This is maybe a "strange" behaviour, but during the development I have used it to test some FreeCAD internals so it is here.

The Import work is done in two phases in the first phase the CB file is read and the CAD entities are shown on the CamBam Tab, this permit to extract the ID that is used in the "import" phase to extract from the XML Etree loaded in memory (maybe not very efficient, but the xml.etree in python could be used in different manners).

More improvement are possible, and the usefullness of this piece of software for now has to be taken as a work in progress i hope driven from the CB community interest.  

Thanks to all for the help (even the test is an invaluable help), feel free to let me know what do you think and maybe if you use it with other files than the test file included, if possible put this files included in your post.

For now the transformation matrix isn't taken in account, as I have no real examples of it in my CB files, if someone is kindly enough to send me a CB file with a real transformation matrix, i will attempt to implement it.

As you maybe haven't noted there is some difference in the file displayed in the "CamBam" Tab on FreeCAD, and they are related to the information that the CB XML file holds in it, in "PolyRectangle" the creation point are present in the XML structure and these information are used to draw the entity in FreeCAD, the rectangle is not "calculated" by the program but the "Polyline points" information in the CB XML file are used,, resolving the bulge factor to "implement" the "rounded corner" property on CamBam.

Maybe I will put also the "Region" information that internally have the OuterCurve Polyline and the "holecurves" polyline internally representes simply as "Polylines".

Regards

Carlo D.
« Last Edit: October 09, 2018, 09:08:05 am by onekk » Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
onekk
Wookie
****
Offline Offline

Posts: 403


View Profile
« Reply #9 on: October 09, 2018, 09:10:46 am »

pixelmaker

I'm investigating a mean to take in account those differences, but as I have not Mac OS for testing the code, if you can test my modification ASA I've impletemented them, thanks to EddyCurrent I hope to be able to put some test about the Qt version used or the presence of Pyside2 (that is related to Qt5)

The qt version is reported by PySide i have to check how to import the correct PySide and check the Qt version.

Stay tuned and Regards

Carlo D.
« Last Edit: October 09, 2018, 09:57:09 am by onekk » Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
BR52
Wookie
****
Offline Offline

Posts: 327



View Profile
« Reply #10 on: October 10, 2018, 20:58:45 pm »

Hello Ralf,

I am not user of mac osx.
In FreeCAD already have PySide embedded with your library.
So you do not need to install the PySide.

Whoever develops other App using PySide, has to install PySide.
https://pypi.org/project/PySide/
With the "python pip install PySide" command.

     Please see the two screenshot.

   Armando


* PySide.jpg (178.02 KB, 1125x634 - viewed 20 times.)

* PySide_noPython.jpg (446.67 KB, 1920x1080 - viewed 22 times.)
Logged
pixelmaker
CNC Jedi
*****
Offline Offline

Posts: 1653


View Profile WWW
« Reply #11 on: October 11, 2018, 09:34:18 am »

Inside the FreeCAD.app/Contents/lib/python2.7/sidepackages there are two folders, one named PySide2 and the other Pyside2uic. The contents of the folders can be seen on the screenshots. The path can be seen at the bottom of the window. I can't find PySide on my computer, just PySide2

ralf


* Bildschirmfoto 2018-10-11 um 10.29.49.png (85.6 KB, 857x647 - viewed 21 times.)

* Bildschirmfoto 2018-10-11 um 10.33.07.png (64.93 KB, 888x732 - viewed 17 times.)
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3692



View Profile
« Reply #12 on: October 11, 2018, 14:56:04 pm »

I should have mentioned I'm using Freecad 0.18 as recommended by Dave Benson here; http://www.cambam.co.uk/forum/index.php?topic=7579.msg61167#msg61167
Logged
BR52
Wookie
****
Offline Offline

Posts: 327



View Profile
« Reply #13 on: October 11, 2018, 15:53:05 pm »

In the "../Mod/OneCAM-FreeCAD" folder there is a file called "OCB_Gui.py"

Open the file in the text editor change the line with "from PySide import QtCore, QtGui" to
"from PySide2 import QtCore, QtGui", save the file.

In the "../Mod/OneCAM-FreeCAD" folder, Delete all files with *.pyc extension if exists.

                                Run FreeCad.

   Armando



* PySide2.jpg (122.54 KB, 1125x634 - viewed 20 times.)

* FreecadBR.jpg (315.5 KB, 1920x1080 - viewed 20 times.)
« Last Edit: October 11, 2018, 16:01:22 pm by BR52 » Logged
onekk
Wookie
****
Offline Offline

Posts: 403


View Profile
« Reply #14 on: October 11, 2018, 23:05:34 pm »

The problem is more related to the way FreeCAD has used PySide.

I'm using 0.17 and internally it uses Qt4 and Pyside (that are the binding for Qt4) and Python2.

0.18 uses Qt5 and PySide2 and Python3.

The main concern is that I'm using Devuan Ascii (Same base as Debian Stretch but without SystemD) and it is using QT4 and Python2, even if the AppImage of 0.18 is using the new versions, of Qt5 and Python3, there are some reports that says that in Debian the new 0.18 is causing troubles.

As I don't want to download 250 and more MB of the new 0.18 AppImage for now, I have to investigate these reports, as I'm on a paid WiFi internet connection (No decent cables services in my town) i have to be careful on Bandwidth.

I'm working on taking in account the PySide2 thing but I need some support.

In the next days, maybe after the WE i will post a "new" beta of this workbench.

Thanks to all and Regards

Carlo D.
Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
Pages: [1] 2 3 4
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.146 seconds with 21 queries.

Copyright © 2018 HexRay Ltd. | Sitemap