use different versions of importIFC.py in a WB

This forum section is only for IFC-related issues
Post Reply
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

use different versions of importIFC.py in a WB

Post by bernd »

I use different versions of the function "def insert .." of importIFC.py. I found the best for me not to have different functions "def insert .." in one importIFC-file but instead have different importIFC.py-files. It is much easier to merge new commits from master this way. But I need to copy and rename the files if I would like to use a different one during import.

I allready have a wb including some tools with icons. I was not able to map the file --> open dialog for ifc and my own importIFC.py to a command (tool) of my new wb. With this I would have for each importIFC_X an own command (tool, icon).

Is it possible to archive this?

What I got working was to map the following to a command (tool, icon) o my own WB.

Code: Select all

myown_importIFC.open("absolute_path_to_the_ifc/ifcfilename.ifc")
But with this I have to put the path and filename in the pythonfile of my WB.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: use different versions of importIFC.py in a WB

Post by yorik »

Gui.addExportType() is what you need I think. Have a look in Arch/InitGui.py
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: use different versions of importIFC.py in a WB

Post by bernd »

    yorik wrote:Gui.addExportType() is what you need I think. Have a look in Arch/InitGui.py
    GUI.addImportType() did the trick, thanks for the tip. I had to comment the line in Arch wb to get it working with my importIFCmin. It would be great if the line of the CURRENT wb is taken. Means if Arch is active, the importer of Arch is taken and if MyWb is active the importer of MyWb is taken. Is there a way to archive this?
    User avatar
    yorik
    Founder
    Posts: 13640
    Joined: Tue Feb 17, 2009 9:16 pm
    Location: Brussels
    Contact:

    Re: use different versions of importIFC.py in a WB

    Post by yorik »

    I don't think so, but serveral modules can define importers for the same filetype... Just use another description, for example "Industry Foundaton Classes (MyWB) (*.ifc)" this way you'll have both in the export dropdown list
    User avatar
    bernd
    Veteran
    Posts: 12849
    Joined: Sun Sep 08, 2013 8:07 pm
    Location: Zürich, Switzerland
    Contact:

    Re: use different versions of importIFC.py in a WB

    Post by bernd »

    Ahh thanks, but how about import?
    User avatar
    shoogen
    Veteran
    Posts: 2823
    Joined: Thu Dec 01, 2011 5:24 pm

    Re: use different versions of importIFC.py in a WB

    Post by shoogen »

    bernd wrote:Ahh thanks, but how about import?
    When you import a file with more than one registred iporeted, you will see a dialog to choose.
    Classical example is SVG which can be imported using the drawing module (view in a own view) or using the draft module (import the geometry as part features)
    User avatar
    yorik
    Founder
    Posts: 13640
    Joined: Tue Feb 17, 2009 9:16 pm
    Location: Brussels
    Contact:

    Re: use different versions of importIFC.py in a WB

    Post by yorik »

    Yes, same thing... use Gui.addImportType and give it another description than those already available.
    User avatar
    bernd
    Veteran
    Posts: 12849
    Joined: Sun Sep 08, 2013 8:07 pm
    Location: Zürich, Switzerland
    Contact:

    Re: use different versions of importIFC.py in a WB

    Post by bernd »

    yorik wrote:... give it another description than those already available.
    That was it. One needs to have different description if there are more than one Gui.addImportType for a file extension.

    thanks very much to Sebastian and Yorik

    bernd :D
    Post Reply