Error when importing Arch module

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Error when importing Arch module

Post by yorik »

Ah about objects being grey, that is normal. When working in console mode, objects don't have their GUI part, and so they are without color information...
User avatar
rockn
Veteran
Posts: 1791
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: Error when importing Arch module

Post by rockn »

There is a problem in importDXF.py

Code: Select all

jo@woodserver:~$ FreeCADCmd 
FreeCAD 0.15, Libs: 0.15R3792 (Git)
(c) Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2011
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> import Draft
>>> import Drawing
>>> import Part
>>> import importDXF
DXF libraries not found. Downloading...
downloading https://raw.github.com/yorikvanhavre/Draft-dxf-importer/master/dxfColorMap.py ...
downloading https://raw.github.com/yorikvanhavre/Draft-dxf-importer/master/dxfImportObjects.py ...
downloading https://raw.github.com/yorikvanhavre/Draft-dxf-importer/master/dxfLibrary.py ...
downloading https://raw.github.com/yorikvanhavre/Draft-dxf-importer/master/dxfReader.py ...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Mod/Draft/importDXF.py", line 1849, in <module>
    dxfDefaultColor = getColor()
  File "/usr/local/Mod/Draft/importDXF.py", line 277, in getColor
    c = params.GetUnsigned("DefaultShapeLineColor",0)
NameError: global name 'params' is not defined
>>> exit()
Replace "params" by "p" fix the issue.
Formations - Assistance - Développement : https://freecad-france.com
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Error when importing Arch module

Post by yorik »

Fixed, thanks!
User avatar
rockn
Veteran
Posts: 1791
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: Error when importing Arch module

Post by rockn »

In WorkingPlane.py

Code: Select all

FreeCADCmd 
FreeCAD 0.15, Libs: 0.15R3792 (Git)
(c) Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2011
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> import Arch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Mod/Arch/Arch.py", line 39, in <module>
    from ArchSectionPlane import *
  File "/usr/local/Mod/Arch/ArchSectionPlane.py", line 24, in <module>
    import FreeCAD,WorkingPlane,math,Draft,ArchCommands,DraftVecUtils
  File "/usr/local/Mod/Draft/WorkingPlane.py", line 25, in <module>
    import FreeCAD, FreeCADGui, math, DraftVecUtils
ImportError: No module named FreeCADGui
>>> 
In ArchStructure.py

Code: Select all

  File "/usr/local/Mod/Arch/ArchStructure.py", line 303, in makeStructure
    obj.Base.ViewObject.hide()
AttributeError: 'NoneType' object has no attribute 'hide'
In Draft.py

Code: Select all

    dim = Draft.makeDimension(App.Vector(curseur, 0.0, 0.0),App.Vector(curseur + i, 0.0, 0.0),App.Vector(0.0, -200.0, 0.0))
  File "/usr/local/Mod/Draft/Draft.py", line 685, in makeDimension
    normal = App.Vector(0,0,1)
NameError: global name 'App' is not defined

Code: Select all

    annoTxt = Draft.makeText(i,point=App.Vector(pergolaLongueur + 2200 + pergolaHauteur, pergolaLargeur + 800 + pergolaHauteur-curseur,0.0))
  File "/usr/local/Mod/Draft/Draft.py", line 893, in makeText
    if not screen: obj.ViewObject.DisplayMode="World"
AttributeError: 'NoneType' object has no attribute 'DisplayMode'
Formations - Assistance - Développement : https://freecad-france.com
User avatar
rockn
Veteran
Posts: 1791
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: Error when importing Arch module

Post by rockn »

Between r3727 et r3792 something have changed.
In 3727 makeStructure create a visible object.
In 3792 makeStructure create a hidden object, I have to open it with FreeCAD gui and changed value manually in property editor to refresh the model. And I get some error at the opening(if Arch WB is not load).

Code: Select all

FreeCADCmd 
FreeCAD 0.15, Libs: 0.15R3792 (Git)
(c) Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2011
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> App.newDocument("Sans nom")
<Document object at 0x2480c50>
>>> App.setActiveDocument("Sans_nom")
>>> doc = App.ActiveDocument
>>> import Arch
>>> Arch.makeStructure(length=1000.0, width=100.0, height=100.0, name="Poutre")
<FeaturePython object at 0x2b37868>
>>> doc.recompute()
make ordering: 
Poutre dep on: Recompute
Solv: Executing Feature: Poutre
>>> doc.saveAs(str("Test.fcstd"))
>>> 
The file made with FreeCADCmd
Test.fcstd
(1.74 KiB) Downloaded 64 times
It seem that if there is base object, there is no problem.
Formations - Assistance - Développement : https://freecad-france.com
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Error when importing Arch module

Post by yorik »

Okay all these issues should be fixed now...
User avatar
rockn
Veteran
Posts: 1791
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: Error when importing Arch module

Post by rockn »

yorik wrote:Okay all these issues should be fixed now...
Thank you Yorik !
I have a problem with dimensions

Code: Select all

buildWithOutGUI/bin$ ./FreeCADCmd 
FreeCAD 0.15, Libs: 0.15R3817 (Git)
(c) Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2011
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> import Draft
>>> import Arch
>>> App.newDocument("Sans nom")
<Document object at 0x22cb800>
>>> App.setActiveDocument("Sans_nom")
>>> App.ActiveDocument=App.getDocument("Sans_nom")
>>> import Draft
>>> Draft.makeDimension(FreeCAD.Vector(-0.0912128388882,0.225349321961,0.0),FreeCAD.Vector(2.41445708275,0.300465762615,0.0),FreeCAD.Vector(2.31251335144,0.858473658562,0.0))
Traceback (most recent call last):
  File "/home/jo/Logiciels/FreeCAD/free-cad-code/buildWithOutGUI/Mod/Draft/Draft.py", line 3001, in onChanged
    obj.setEditorMode('Distance',1)
<type 'exceptions.AttributeError'>: Property container has no property 'Distance'
<Document object>
>>> App.getDocument("Sans_nom").saveAs('/home/jo/Documents/FreeCAD/Cote.fcstd')
>>> 
The file have dimension object but it have no View property...
Cote.fcstd
(1.14 KiB) Downloaded 62 times
Formations - Assistance - Développement : https://freecad-france.com
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Error when importing Arch module

Post by yorik »

Hm I get a different error here, but it looks like there is a bug somewhere. When running FreeCAD in console mode, although objects have a "ViewObject" attribute (that should contain None IIRC), there is an error when you try to read it:

Code: Select all

>>> doc = FreeCAD.newDocument()
>>> FreeCAD.ActiveDocument
<Document object at 0xfa8b10>
>>> obj = doc.addObject("App::FeaturePython","Test")
>>> obj
<FeaturePython object at 0x10557e8>
>>> obj.ViewObject
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getDocument'
I'll see if I can fix it, otherwise I'll call for Werner's powers :)
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Error when importing Arch module

Post by yorik »

Ok this should be solved now!
Post Reply