Civil engineering feature implementation (Transportation Engineering)

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
kisolre
Posts: 2102
Joined: Wed Nov 21, 2018 1:13 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby kisolre » Mon Apr 15, 2019 3:11 pm

There is some case sensitive mixup. If I change names to proper case it works to some degree. But I noticed something that will not work under windows - you have bots XML and xml folders under project - here the XML is created first and then everything from xml is put in XML - for windows those are the same. Since XML looks like just a placeholder for now could you renale it to _XML or something else meaningfull to you to avoid such errors under windows? Also not sure why the import is case sensitive here and how should this be handled.
kisolre
Posts: 2102
Joined: Wed Nov 21, 2018 1:13 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby kisolre » Mon Apr 15, 2019 3:19 pm

Tried fresh clone - same. Only XML gets created, imports are case sensitive.
User avatar
Joel_graff
Posts: 1717
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Mon Apr 15, 2019 3:49 pm

kisolre wrote:
Mon Apr 15, 2019 3:11 pm
There is some case sensitive mixup. If I change names to proper case it works to some degree. But I noticed something that will not work under windows - you have bots XML and xml folders under project - here the XML is created first and then everything from xml is put in XML - for windows those are the same. Since XML looks like just a placeholder for now could you renale it to _XML or something else meaningfull to you to avoid such errors under windows? Also not sure why the import is case sensitive here and how should this be handled.
Right. I did change the case of the XML module when I refactored things. Case matters everywhere except the Windows file system, unfortunately.

Anyway, this was a caching issue, I guess. Definitely just leveled up in my git skills. :)

Try again - the XML folder should be gone from both master and dev branches.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
HakanSeven12
Posts: 751
Joined: Wed Feb 06, 2019 10:30 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby HakanSeven12 » Mon Apr 15, 2019 4:01 pm

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16110 (Git)
Build type: Release
Branch: (HEAD detached at upstream/releases/FreeCAD-0-18)
Hash: f7dccfaa909e5b9da26bf50c4a22ccca9bb10c40
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Turkish/Turkey (tr_TR)

Code: Select all

During initialization the error cannot import name 'units' occurred in freecad.trails
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 145, in InitApplications
  File "C:\Program Files\FreeCAD 0.18\bin\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Hakan\AppData\Roaming\FreeCAD\Mod\freecad.trails-dev\freecad\trails\init_gui.py", line 30, in <module>
    from .project.commands \
  File "C:\Users\Hakan\AppData\Roaming\FreeCAD\Mod\freecad.trails-dev\freecad\trails\project\commands\import_alignment_cmd.py", line 29, in <module>
    from ..tasks.alignment.import_alignment_task import ImportAlignmentTask
  File "C:\Users\Hakan\AppData\Roaming\FreeCAD\Mod\freecad.trails-dev\freecad\trails\project\tasks\alignment\import_alignment_task.py", line 35, in <module>
    from . import import_xml_subtask #, ImportCsvSubtask
  File "C:\Users\Hakan\AppData\Roaming\FreeCAD\Mod\freecad.trails-dev\freecad\trails\project\tasks\alignment\import_xml_subtask.py", line 28, in <module>
    from ...xml.alignment_importer import AlignmentImporter
  File "C:\Users\Hakan\AppData\Roaming\FreeCAD\Mod\freecad.trails-dev\freecad\trails\project\xml\alignment_importer.py", line 31, in <module>
    from ..support import units, utils
ImportError: cannot import name 'units'
--------------------------------------------------------------------------------
User avatar
Joel_graff
Posts: 1717
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Mon Apr 15, 2019 4:05 pm

HakanSeven12 wrote:
Mon Apr 15, 2019 4:01 pm
During initialization the error cannot import name 'units' occurred in freecad.trails
This appears related to the issue @kisolre reported...

Not sure how to fix it if you can't just pull the latest changes. Maybe delete and re-clone the repo?
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
HakanSeven12
Posts: 751
Joined: Wed Feb 06, 2019 10:30 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby HakanSeven12 » Mon Apr 15, 2019 4:33 pm

Joel_graff wrote:
Mon Apr 15, 2019 4:05 pm

This appears related to the issue @kisolre reported...

Not sure how to fix it if you can't just pull the latest changes. Maybe delete and re-clone the repo?
I think I find the problem. You are calling files with small latters but file names are starting with big latters.

I changed file names now it works.
User avatar
Joel_graff
Posts: 1717
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Mon Apr 15, 2019 4:51 pm

HakanSeven12 wrote:
Mon Apr 15, 2019 4:33 pm
I think I find the problem. You are calling files with small latters but file names are starting with big latters.

I changed file names now it works.
I don't think that's going to work long-term.

I'm doing development on a Windows machine at the moment and it works as it is with everything lower-case.

The problem is I previously had a module named 'XML", but I renamed 'xml' in keeping with the new workbench naming guidelines.

Apparently, the change was cached locally on my machine and never pushed to github, so the original folder was never deleted. I've since deleted it.

If you still have an "XML" folder, you have a problem. Folders and filenames should all be lower case. I recommend deleting and re-cloning the "freecad.trails" repo from my github to get past this.

My apologies for the issue - hopefully this sort of thing won't happen again!
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
kisolre
Posts: 2102
Joined: Wed Nov 21, 2018 1:13 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby kisolre » Mon Apr 15, 2019 6:29 pm

I renamed all files in geometry, support and xml to lowercase and it loads ok.
Then uppon changing to the workbench there are some icon paths errors - probably icons folder was moved under resources and paths were not updated? There were also some leading "/" missing. Fixing those and now the workbench loads Ok.

Now opening that Sugar...FCStd gives:

Code: Select all

<unknown exception traceback><class 'ModuleNotFoundError'>: No module named 'transportationwb'

Had you renamed the workbench after saving that file?
Trying to load the xml file gives:

Code: Select all

<Element '{http://www.landxml.org/schema/LandXML-1.2}Project' at 0x000000BE81F8B2C8>
<Element '{http://www.landxml.org/schema/LandXML-1.2}Units' at 0x000000BE81F8B368>
<Element '{http://www.landxml.org/schema/LandXML-1.2}Alignments' at 0x000000BE81F8B458>
Document units of meter expected, units of footfound
Invalid project units
Traceback (most recent call last):
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\freecad.trails\freecad\trails\project\tasks\alignment\import_alignment_task.py", line 168, in examine_file
    self.subtask = import_xml_subtask.create(subpanel, file_path)
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\freecad.trails\freecad\trails\project\tasks\alignment\import_xml_subtask.py", line 35, in create
    return ImportXmlSubtask(panel, filepath)
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\freecad.trails\freecad\trails\project\tasks\alignment\import_xml_subtask.py", line 54, in __init__
    self._setup_panel()
  File "C:\Users\Wivern\AppData\Roaming\FreeCAD\Mod\freecad.trails\freecad\trails\project\tasks\alignment\import_xml_subtask.py", line 60, in _setup_panel
    self.panel.projectName.setText(self.data['Project']['ID'])
TypeError: 'NoneType' object is not subscriptable
I had set the FreeCAD units to Building US but still get the same error. Switching to Imperial Civil seems to work. This should be mentioned in the Readme?!?
On successfull load of that xml I also get this:

Code: Select all

Missing Curve Start coordinate in alignment Sugar Grove Road
Missing Curve End coordinate in alignment Sugar Grove Road
Missing Curve Center coordinate in alignment Sugar Grove Road
Missing Curve Start coordinate in alignment Sugar Grove Road
Missing Curve End coordinate in alignment Sugar Grove Road
Missing Curve Center coordinate in alignment Sugar Grove Road
Missing Curve Start coordinate in alignment Sugar Grove Road
Missing Curve End coordinate in alignment Sugar Grove Road
Missing Curve Center coordinate in alignment Sugar Grove Road
Missing Curve Start coordinate in alignment Penrose Road West
Missing Curve End coordinate in alignment Penrose Road West
Missing Curve Center coordinate in alignment Penrose Road West
Missing Curve Start coordinate in alignment Penrose Road East
Missing Curve End coordinate in alignment Penrose Road East
Missing Curve Center coordinate in alignment Penrose Road East
Here is a diff with what I changed. It did not catch the rename to lowercase.
Attachments
2019.04.15_FreeCAD.Trails.diff.txt
(1.35 KiB) Downloaded 11 times
User avatar
Joel_graff
Posts: 1717
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation (Transportation Engineering)

Postby Joel_graff » Mon Apr 15, 2019 8:05 pm

kisolre wrote:
Mon Apr 15, 2019 6:29 pm
Now opening that Sugar...FCStd gives:
I caught that at the last minute, but forgot to fix it. Yes, I renamed it. Not sure what's triggering that error. Will give a shot at fixing it tomorrow.
kisolre wrote:
Mon Apr 15, 2019 6:29 pm
I renamed all files in geometry, support and xml to lowercase and it loads ok.
Then upon changing to the workbench there are some icon paths errors - probably icons folder was moved under resources and paths were not updated? There were also some leading "/" missing. Fixing those and now the workbench loads Ok.
Ok, so all files in xml should have been lowercase by now. Geometry - I must have just missed those, though I thought I had them changed, too... oy.

I'm starting to think some commits got dumped somewhere. :?
kisolre wrote:
Mon Apr 15, 2019 6:29 pm
I had set the FreeCAD units to Building US but still get the same error. Switching to Imperial Civil seems to work. This should be mentioned in the Readme?!?
Ah, yes. I've been working with Civil Imperial, but I've tried to write it to support metric as well. No doubt there's going to be issues with that.

I'm thinking it should pop up and allow the user to switch document units to match the file, if not already. At some point I'll need to support unit conversions, too. Not sure how to handle that atm.
kisolre wrote:
Mon Apr 15, 2019 6:29 pm
On successfull load of that xml I also get this:
Those are not an issue. Basically, it's just a check to make sure the geometry is defined well enough. The missing parameters don't all need to be defined - just enough that I can calculate the rest after the fact. So the messages are lists of missing parameters, but aren't necessarily going to break anything. They're warnings, at most.

That said, the workbench saves out completely-described geometry, so all parameters are defined.

Anyway, thanks for going through it. It's hard to catch these issues when you develop in a vacuum like I've been doing. :)
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
kisolre
Posts: 2102
Joined: Wed Nov 21, 2018 1:13 pm

Re: Civil engineering feature implementation (Transportation Engineering)

Postby kisolre » Mon Apr 15, 2019 8:18 pm

Joel_graff wrote:
Mon Apr 15, 2019 8:05 pm
Anyway, thanks for going through it. It's hard to catch these issues when you develop in a vacuum like I've been doing.
600 posts is hardly a vacuum :) Maybe it is very narrow field with existing tools so not many people to search for alternatives...

Today in front of my home I saw a surveyor taking measurements every 20-50 cm... didn't think that such resolution/accuracy was possible... you learn something new every day :)