[Macro] New Honeycomb Solid Macro (to be tested)

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
christiangda
Posts: 5
Joined: Sat Jan 16, 2021 7:15 pm

[Macro] New Honeycomb Solid Macro (to be tested)

Post by christiangda »

Hi everyone,

Today I finished my Honeycomb Solid Macro and I want to publish it into the default Macros repository, but according to the best practice, I'm sharing it here to be tested and reviewed by you.

Please test it, and let me know if work fine for you. The code is versioned in my GitHub repository https://github.com/christiangda/FreeCAD ... ycombSolid
honeycomb-2.png
honeycomb-2.png (170.4 KiB) Viewed 1039 times
Last edited by christiangda on Sat Jan 30, 2021 8:04 pm, edited 1 time in total.
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: [Macro] New Honeycomb Solid Macro (to be tested)

Post by kisolre »

Hello and welcome to the forum.
I dont know how is this supposed to work but when the file with a honeycomb is saved and then loaded it still has all the properties but can not be modified - some errors are shown. I tried then creating a second honeycomb. While the file is not closed it is properly edited. But the first honeycomb still does not change - no errors thou.
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: [Macro] New Honeycomb Solid Macro (to be tested)

Post by mario52 »

hi

good macro thanks work very well

but the icon is not saved in file (as in my macro example !!)

(similar macro Macro_FCHoneycombMaker)

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
christiangda
Posts: 5
Joined: Sat Jan 16, 2021 7:15 pm

Re: [Macro] New Honeycomb Solid Macro (to be tested)

Post by christiangda »

kisolre wrote: Sat Jan 16, 2021 8:12 pm Hello and welcome to the forum.
I dont know how is this supposed to work but when the file with a honeycomb is saved and then loaded it still has all the properties but can not be modified - some errors are shown. I tried then creating a second honeycomb. While the file is not closed it is properly edited. But the first honeycomb still does not change - no errors thou.
Hi @kisolre, you are right, I'm working on it, I'm not sure why it happens, I'm reading about the error I have.

Code: Select all

11:02:42  <string>(1)<class 'AttributeError'>: Module __main__ has no class HoneycombSolid
11:02:43  <string>(1)<class 'AttributeError'>: Module __main__ has no class ViewProviderHoneycombSolid
I have been creating my macro following the rules and samples of
https://wiki.freecadweb.org/Scripted_objects
https://github.com/FreeCAD/FreeCAD/blob ... ePython.py

I'm I don`t know why when you reopen the Freecad file, even if the macro is installed these errors appear
christiangda
Posts: 5
Joined: Sat Jan 16, 2021 7:15 pm

Re: [Macro] New Honeycomb Solid Macro (to be tested)

Post by christiangda »

mario52 wrote: Sat Jan 16, 2021 8:57 pm hi

good macro thanks work very well

but the icon is not saved in file (as in my macro example !!)

(similar macro Macro_FCHoneycombMaker)

mario

Hi Mario, thanks!

Let me tell you that your macro was my inspiration, and I only am trying to use different honeycombs solids in the same documents, that the reason why I have created this.

My project using the firs version of my macro is: https://github.com/christiangda/3d-prin ... case.FCStd if you want to check it.

I'm just a Hobbyist of 3d printing trying to used FreeCAD as my favourite tool for 3d designs :D

I'll implement the new version of my macro as soon I fixed the problem of the icon and the problem of properties when the file is reopened.

I'm reading how to create a Custom Icon and how to save it to be persistent, thank you again for your comment.

As soon as I fixed these problems I'll comment here.
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: [Macro] New Honeycomb Solid Macro (to be tested)

Post by mario52 »

hi
christiangda wrote: Sun Jan 17, 2021 10:24 am Let me tell you that your macro was my inspiration,
the Macro_FCHoneycombMaker is at TheMarkster (not mario52)
christiangda wrote: Sun Jan 17, 2021 10:24 am As soon as I fixed these problems I'll comment here.
thanks

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
galou_breizh
Posts: 437
Joined: Wed Sep 15, 2010 9:38 am

Re: [Macro] New Honeycomb Solid Macro (to be tested)

Post by galou_breizh »

Hello,

the page https://wiki.freecadweb.org/Scripted_ob ... attributes explains more about how to save attributes. I think that one of the things then need to be respected is that the class must be importable, i.e. a *.py file, not a *.FCMacro file. I don't have the time to double-check that but this would mean that the macro needs to be split into a FCMacro and a py file containing the needed classes. The GeodesicDome macro from the official repository is a working example of parametric object that works after FreeCAD restart.

Gaël
christiangda
Posts: 5
Joined: Sat Jan 16, 2021 7:15 pm

Re: [Macro] New Honeycomb Solid Macro (to be tested)

Post by christiangda »

galou_breizh wrote: Wed Jan 20, 2021 7:30 pm Hello,

the page https://wiki.freecadweb.org/Scripted_ob ... attributes explains more about how to save attributes. I think that one of the things then need to be respected is that the class must be importable, i.e. a *.py file, not a *.FCMacro file. I don't have the time to double-check that but this would mean that the macro needs to be split into a FCMacro and a py file containing the needed classes. The GeodesicDome macro from the official repository is a working example of parametric object that works after FreeCAD restart.

Gaël
Hi Gaël

Thank you very much for your comment, this help me to solve the problem ;)

When you create a ParametricObject it is necessary to create a folder with the content of your code as ".py" and the ".FCMacro" needs to have python "import <your class into your .py file>"

Now it is working fine when you save and reload your files.

I'm creating the pull request to distribute my macro! https://github.com/FreeCAD/FreeCAD-macros/pull/89

Christian
Post Reply