Classy-Closets / Snap-Updates

Snap-Updates
6 stars 0 forks source link

XML Export: Fillers #271

Closed TedCC1209 closed 3 years ago

TedCC1209 commented 3 years ago

Currently, fillers export the exact width that is entered into the Construction Options, even if that is just 0.5". We need to change the export logic for fillers to be as follows:

-Add 2" to the width entered in Construction Options, with a minimum exported width amount of 4"

TedCC1209 commented 3 years ago

@ClassyTeddy since @JJanneh is already working on the edgebanding the bottom edge for fillers, perhaps this issue would be something he can address too if you haven't already looked into it. Let us know

ClassyTeddy commented 3 years ago

I think he should be able to address this. All you need to do is CV add some logic to the get_part_width function

JJanneh commented 3 years ago

@ClassyTeddy Here I started with some Logic get_part_width: -Add 2" to the width entered in Construction Options, with a minimum exported width amount of 4"

    if self.is_filler_bp(assembly):
        if not assembly.obj_bp.lm_closets.is_filler_bp and not assembly.obj_bp.lm_closets.is_filler_bp:
            width += unit.inch(4.0)

    if assembly.obj_bp.lm_closets.is_filler_bp:
        against_left_wall = assembly.get_prompt("Against Left Wall")
        against_right_wall = assembly.get_prompt("Against Right Wall")
        if(against_left_wall and against_right_wall):
            if(against_left_wall.value()):
                width += unit.inch(4.0)
            if(against_right_wall.value()):
                width += unit.inch(4.0)

    return self.distance(width) 
ClassyTeddy commented 3 years ago

Hey @JJanneh, this is sort of on the right track, but you copied too much and things need to be removed.

First off, the third line cancels out the first line. What you copied over was logic looking at different parts, and you just put in filler. So the 2nd and 3rd line can be removed, and the 4th line can be unindented. You also need to change it from adding 4 inches to adding 2 inches. Like this.

if self.is_filler_bp(assembly):
    width += unit.inch(2)

Then, the whole second part is not right. What that is doing is looking for prompts that are irrelevant to the task at hand, and adding more to the width. What we want instead is to check the current width, and if it is under a 4", make it be 4". It can also all be done under 1 if statement, and the second half should be removed. So the whole thing should look like this:

if self.is_filler_bp(assembly):
    width += unit.inch(2)
    if width < unit.inch(4):
        width = unit.inch(4)

Let me know if this all makes sense.

JJanneh commented 3 years ago

Hello @ClassyTeddy searched for the get_part_width function. fillers export section and CV the Logic into the file. Ran the changes the xml data will no longer exports from snap_export.py file. Not sure what I'm missing on this section if you have any further instructions it would be greatly appreciated thanks.

ClassyTeddy commented 3 years ago

If it isn't exporting then that means you are getting an error. Try exporting it again, andet me know what error appears in the console.

JJanneh commented 3 years ago

@ClassyTeddy Hello I tried self.get_part_width(assembly)), but the file exports with error codes listed below error This seems to be in the working in place no errors just not sure. Screenshot (127)

ClassyTeddy commented 3 years ago

Oh you were saying it wasn't exporting.

That is in the wrong place. That is in the middle of a set of code trying to determine full length flat crown. That is not in the get_part_width function.

Remember a function definition always starts with def. So look for def get_part_width to find where the function is defined, then find a place to put it in the function

JJanneh commented 3 years ago

@ClassyTeddy loglog Located def get_part_width and Ran SNaP exported XML after. no errors. thanks Screenshot (129)

ClassyTeddy commented 3 years ago

That is still not quite right. If you look at line 717, it is an if statement that is looking for capping bottoms. Well the filler isn't a capping bottom, so your code will never run in it's current spot. You need to unident your lines twice.

ClassyTeddy commented 3 years ago

Also, I just noticed that on line 725 self needs to be assembly.obj_bp.lm_closets. because you aren't checking if self is a filler (self in this case is most likely referring to snap_export.py but I am not positive), but you are checking to see if the assembly inputted into get_part_width is a filler.

Also, line 727 and 728 need to be indented, otherwise, it is checking to see if ANY assembly less wide than 4 inches, and if it is, it will make them 4 inches.

JJanneh commented 3 years ago

That makes sense. I was getting a bunch of errors. I realize that I need to change the export logic for fillers. Looked for def get_part_width to find where the function is defined, then find a place to put it in the function. Will make the changes and try again.

JJanneh commented 3 years ago

@ClassyTeddy Made the changes and this is the Output Export created. I just used the example assembly.obj_bp.lm_closets.is_bottom_capping_bp: error3 Screenshot (131) if assembly.obj_bp.lm_closets.is_filler_bp(assembly): generates this error. error4

ClassyTeddy commented 3 years ago

So that error says that on line 698, you have this:

if assembly.obj_bp.lm_closets.is_filler_bp(assembly)

So this is causing an error because .is_filler_bp is NOT a function. It is a true or false statement, or a boolean or bool. That is why it says 'bool' object is not callable. Because you are trying to call it as if it were a function by adding the (assembly). I am unsure what you code you have after 698, but that line is what is causing the error.

Also, you still need to indent line 728 because you only want to check that if statement IF the assembly is a filler.

JJanneh commented 3 years ago

@ClassyTeddy if assembly.obj_bp.lm_closets.is_filler_bp(assembly): Indent changes made and no error produced on output No_Errors_Displayed XML-Export-Fillers branch

JJanneh commented 3 years ago

Exported several times no more error messages. XML-Export-Fillers ready to test Screenshot (267)

TedCC1209 commented 3 years ago

Fillers look to still be exporting exact sizes for me on the XML-Export-Fillers branch, not with the 4" minimum or adding 2" to the exported width.

Also need to make sure this will do the same thing for capping fillers https://github.com/CCDevNelson/Snap-Updates/issues/253 (add 2" to the width when exporting with a minimum 4" width), so not sure if we want to include this fix, when we get it working, in the option-to-edge-bottom-edge branch.

JJanneh commented 3 years ago

@TylerStandage @TedCC1209 Updated XML-Export-filler branch files currently exports per your request. Confirmed @ClassyTeddy

TylerStandage commented 3 years ago

@JJanneh looks good! @ClassyTeddy moving to ready to merge.