Code Monkey home page Code Monkey logo

Comments (16)

APEbbers avatar APEbbers commented on June 23, 2024

I couldn't reproduce the error. However, I've changed the code to try something.
Can you switch to the following branch and see if anything has changed?
"git checkout Patch-1"

The A2plus workbench works differently than the others. it doesn't allow to get to the absolute paths. I've written code for that, which I tweaked.

from billofmaterials-wb.

didiergm avatar didiergm commented on June 23, 2024

git checkout Patch-1 is rejected here
and making a git branch -r I got

origin/Develop
origin/HEAD -> origin/main
origin/main

I am happy, if you tell me which file I need to bring up to date to simply copy/paste the new code

from billofmaterials-wb.

APEbbers avatar APEbbers commented on June 23, 2024

if you can change in the file "GetBOM_A2plus.py" on lines 173 and 256 the following:
replace "if FullPath.startswith("."):" with "if FullPath.startswith(".\\") or FullPath.startswith("./"):"

image

Hopefully that helps

from billofmaterials-wb.

didiergm avatar didiergm commented on June 23, 2024

Sorry to be the bearer of bad news, it does not.

My Python knowledge is at best sparse, so I can't really help debug, but I am happy to do more testing if it helps

from billofmaterials-wb.

APEbbers avatar APEbbers commented on June 23, 2024

If you select the sub assembly. do you see an absolute path like this?
image

from billofmaterials-wb.

didiergm avatar didiergm commented on June 23, 2024

No a path relative to the main assembly

./tiroir/tiroir_assembly.FCStd

from billofmaterials-wb.

APEbbers avatar APEbbers commented on June 23, 2024

Thank!, that's the problem. On my windows pc and my linux pc I have absolute paths when the items are on a different location then the assembly there are in. Probably this is different for some linux versions or with certain settings.

Now I have something to go on and start to figure how to tackle this to cover both situations.

from billofmaterials-wb.

APEbbers avatar APEbbers commented on June 23, 2024

I believe that I've found it. Can you update the WB to version 0.05.11 and give it a try?

from billofmaterials-wb.

didiergm avatar didiergm commented on June 23, 2024

Update did not go as planned :
I first had the option in the addon manager to update, to 0.05.11, I clicked on update, update went through and noticed that the message was "0.05.7" installed, up-to-date. I restarted, checked and I was indeed on 0.05.7
I desintalled completely, restarted, installed again and I am stuck on 0.05.7 , 0.05.11 is not suggested anymore

I then deinstalled, went to the addons directory, removed a directory BillOfMaterials.backup1710312901.0584648 which was a leftover (may be from the manual updates I did yesterday)

started, installed, installer said "version ..11", did the install and again I got version ..7
which is not a happy bunny :

07:58:18 Initializing A2plus Workbench v0.4.64.
07:59:06 Traceback (most recent call last):
07:59:06 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./Load_BoM_Panel.py", line 286, in on_CreateBOM_clicked
07:59:06 GetBOM_A2plus.BomFunctions.Start(
07:59:06 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 723, in Start
07:59:06 raise e
07:59:06 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 701, in Start
07:59:06 self.GetTreeObjects(checkAssemblyType=CheckAssemblyType)
07:59:06 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 74, in GetTreeObjects
07:59:06 self.GoThrough_Objects(
07:59:06 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 184, in GoThrough_Objects
07:59:06 if childObject.objectType == "a2pPart":
07:59:06 AttributeError: 'FeaturePython' object has no attribute 'objectType'

from billofmaterials-wb.

APEbbers avatar APEbbers commented on June 23, 2024

Maybe it helps if you do a git pull from the command line?
You can check if in package.xml, version 0.0.5.11 is mentioned.

You have modified the files by hand. These can give a problem because these are no longer in sync with the versions in github.
Can you try: "git checkout GetBOM_A2plus.py" followed by "Git pull"?

Maybe reverting the file and then update to the latest version helps.

from billofmaterials-wb.

didiergm avatar didiergm commented on June 23, 2024

Something went wrong with the AddOn cache, so even if freecad was saying that I installed version 11, on the next start the version installed was .7. After removing freecad completely and reinstalling it afresh , I now have v11 installed.

But I get this message
21:53:44 Traceback (most recent call last):
21:53:44 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./Load_BoM_Panel.py", line 286, in on_CreateBOM_clicked
21:53:44 GetBOM_A2plus.BomFunctions.Start(
21:53:44 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 723, in Start
21:53:44 raise e
21:53:44 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 701, in Start
21:53:44 self.GetTreeObjects(checkAssemblyType=CheckAssemblyType)
21:53:44 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 74, in GetTreeObjects
21:53:44 self.GoThrough_Objects(
21:53:44 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 184, in GoThrough_Objects
21:53:44 if childObject.objectType == "a2pPart":
21:53:44 AttributeError: 'FeaturePython' object has no attribute 'objectType'

from billofmaterials-wb.

APEbbers avatar APEbbers commented on June 23, 2024

I've found the cause of the error. it was caused by that not all objects have an objectType property.
image

Maybe there was an part or feature added outside A2plus.

Now everything that is not added with the a2plus wb will be ignored. The new version is 0.0.5.12

from billofmaterials-wb.

didiergm avatar didiergm commented on June 23, 2024

Progress, but still not there yet, though. And I hate to waste your time.

Original exception was:
10:31:16 Traceback (most recent call last):
10:31:16 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./Load_BoM_Panel.py", line 286, in on_CreateBOM_clicked
10:31:16 GetBOM_A2plus.BomFunctions.Start(
10:31:16 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 724, in Start
10:31:16 raise e
10:31:16 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 706, in Start
10:31:16 self.CreateTotalBoM(
10:31:16 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 339, in CreateTotalBoM
10:31:16 CopyMainList = self.ReturnDuplicates()
10:31:16 File "/home/didier/.local/share/FreeCAD/Mod/BillOfMaterials/./GetBOM_A2plus.py", line 300, in ReturnDuplicates
10:31:16 if Label.rsplit("", 1)[1].isnumeric() and len(Label.rsplit("", 1)[1]) == 3:
10:31:16 IndexError: list index out of range

However, I would also like to test Assembly3, do you foresee any issues ?

from billofmaterials-wb.

APEbbers avatar APEbbers commented on June 23, 2024

I for see no issues for the Assembly3 WB. the A2plus WB is a bit of a special case. Internally the assembly 3 (and 4) follow more the workings of FreeCAD self.

I actually apricate it that you are willing to test my WB. As you switch to Assembly3 can I perhaps get a copy of your files that generate the latest error? Then I can see what is going on. I probably overlooked a usecase scenario.

from billofmaterials-wb.

didiergm avatar didiergm commented on June 23, 2024

I am dead set on using your addon, I started using Freecad as I have many, quite complex furnitures to make in my house, and I don't want to desing by hand, and my ultimate goal is to go up to an optimized cutlist of plywood sheets (hence my enhancement request about width, length and offset) .

As a software developper myself, I understand that these things take time and needs several or many iterations before being perfect, too bad I don't have the time to learn Python and Freecad's internals or I would have been happy to help more. Perhaps, this is a conversation we can have directly you and I.

I am planning to look at assembly3, but A2Plus almost fit my needs (there are a few missing constraints like distance between planes, but it can be emulated with offsets, not as clean and straight forward as I would like).

By all means, I am happy to carry on helping and I attach all my files, nothing is confidential, if you want e to try and test something, just say so.
envoi.zip

Note that it is work in progress, not yet finished, and again this is my first freecad project, so it my not follow Freecad's best practices, but please do keep us posted on your progress

from billofmaterials-wb.

APEbbers avatar APEbbers commented on June 23, 2024

I've found the cause of the error. It was caused by items that were renamed. This is a totally fine practice. So no worries.
I've fixed this in version 0.0.5.13

In FreeCAD as default when you add parts twice or more, you get _001, _002, etc after the name. I've created a function to return the original part, so that in the BoM, the qty increases and avoid add them all separately.
However I've overlooked the fact that you can use the same part, but rename them differently and then remove the follow up number. That was the cause.
currently, when you rename the same parts differently you will get each item separate in the BoM.

When you use one of the other assembly workbenches, you can expand the subassemblies in the tree. A2plus is different in this area. (as an answer to # #49)

To explain a little about me, I'm actually not a professional software developer but a mechanical engineer. I'd like to program as a hobby and have learned my self Python, c# and VB.net. FreeCAD is for me the ideal program for all my projects. Both for design projects and programming.

from billofmaterials-wb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.