Where are paths rendered to 3d-view?

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
freman
Veteran
Posts: 2198
Joined: Tue Nov 27, 2018 10:30 pm

Where are paths rendered to 3d-view?

Post by freman »

Hi,

I'm trying to find out where individual paths are rendered to the 3d-view. I've just spent about an hour grepping and have not been able to find it.

It appears that drilling paths may not be correctly rendered if G99 is active. They retract like G98 instead of stopping at R value. I wanted to check out what was happening but can't find where this is done.

If anyone who knows their way around can indicate where to look that would be very helpful.

TIA.
MRx
Posts: 319
Joined: Wed Jul 08, 2020 5:59 am
Location: Tainan / Taiwan

Re: Where are paths rendered to 3d-view?

Post by MRx »

What do you mean with not correctly rendered?


In my case the path for my custom command didn't get rendered at all until I modified PathSegmentWalker.cpp.
I added a custom command to linuxcnc (I'm using the B axis stepper motor to turn the spindle), G84.1 in order to make it visible in FreeCAD I had to update PathSegmentWalker as well.

Code: Select all

+++ b/src/Mod/Path/App/PathSegmentWalker.cpp
@@ -275,7 +275,7 @@ void PathSegmentWalker::walk(PathSegmentVisitor &cb, const Base::Vector3d &start
             // relative mode
             absolutecenter = false;
 
-        } else if ((name=="G81")||(name=="G82")||(name=="G83")||(name=="G84")||(name=="G85")||(name=="G86")||(name=="G89")){
+        } else if ((name=="G81")||(name=="G82")||(name=="G83")||(name=="G84")||(name=="G85")||(name=="G86")||(name=="G89")||(name=="G84.1")){
             // drill,tap,bore
             double r = 0;
             if (cmd.has("R"))
User avatar
freman
Veteran
Posts: 2198
Joined: Tue Nov 27, 2018 10:30 pm

Re: Where are paths rendered to 3d-view?

Post by freman »

Ah, many thanks. That explains why I could not find it . I was looking in the python code.

It needs to take account of G99/98 mode in force and it does not appear to be doing this. It always shows a full retraction.

Thanks for the tip.
User avatar
freman
Veteran
Posts: 2198
Joined: Tue Nov 27, 2018 10:30 pm

Re: Where are paths rendered to 3d-view?

Post by freman »

many thanks to MRx.

I now have 3Dview G98/G99-aware. Most of effort was finding where to do it. The mods needed were minimal.

A bit more testing and I'll submit a PR.

Code: Select all

            Base::Vector3d p3(next);
            if (retract_mode == 99)
                p3.*pz = p2.*pz;
            else
                p3.*pz = last.*pz;            
              

Code: Select all

        } else if(name=="G19") {
            pz = &Base::Vector3d::x;
        } else if(name=="G98") {
            retract_mode = 98;
        } else if(name=="G99") {
            retract_mode = 99;
        }
    }
}
Post Reply