Open *.Dwg with Qcad Pro in FCAD

I have my copy of Qcad pro, I inserted the binary path of Qcad (tried too with dwg2dwg lib), but I cannot open any Dwg file in Fcad (ODA import works, but importing very badly). I have to use Qcad to open the Dwg (witch is opened generally speaking very well) convert it => *.dxf and then re-import all (but the import of the text and quotation is really not so good in Fcad).

It’s there any tip or trick to make it working (open directly a Dwg in Freecad without converting it before using Qcad pro)?

OS: Ubuntu 20.04.3 LTS (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.20.
Build type: Release
Branch: unknown
Hash: 39ed257eb4b59ae72ef9522d1d6c6ba886f8222f
Python version: 3.8.10
Qt version: 5.12.8
Coin version: 4.0.0
OCC version: 7.5.2
Locale: Italian/Italy (it_IT)

I suspect there is currently no good direct way. i have had good experiences with varicad viewer

https://forum.freecadweb.org/viewtopic.php?f=13&t=31837&p=561352#p561352

Also curious about this. I’ve tried on Windows, set the importer to QCAD Pro in the import DWG settings, without setting a path, nothing. Then setting the path to the binary qcad, freecad then freezes, try to import then nothing. Then the dwg2dwg lib and also not working. Is there another file that the path needs to point to?

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.26858 (Git)
Build type: Release
Branch: master
Hash: e209bc706d35121098f9bac779bc6b09c24ddd95
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.3
Locale: English/United Kingdom (en_GB)

Lib? According to Import_Export_Preferences you should select an exe.

Post an example file.

There is, as Yorik said :slight_smile:
Anyway I like Qcad pro, I use it as my main DWG viewer for all Autocad files that they send me (sadly no one use an open format, this is a very big problem I our world) it’s a very good 2d cad platform, it’s also opensource and the support for the closed standard *.dwg cost really nothing (Qcad pro cost couple of bucks).
In the past I was using ODA converter, but with bad results. I have installed Librecad in my system but also there I cannot open any *.dwg file.

QCad pro can open pretty any *.dwg, but as said I have to convert it two times in *.dxf and there too for quotation, text and other thing then I have some problme when importing in FCad

I cannot, because I have some *.dwg that other have sent me, these are their files.
But it’s not a problem of the single file I presume, it’s the problem that when you insert the path of Qcad pro installed, FCad freeze completely and/or he says that the file don’t exits. You can test it with any *.dwg that you have.


I’m with Linux, I have only binaries, not *.exe. In the properties you have to select the path of Qcad Pro, but it seems not working to import in Freecd directly via Qcad pro. Maybe there is some flag to activate on the importer, I don’t know.

thank you for the confirmation. I will recommend qcad

Normally, by pointing to the “dwg2dwg” utility, everything should “just works” transparently in FreeCAD.
Here are my settings (linux):
Screenshot from 2022-01-24 13-48-13.png
I understand you guys are on windows? There might be something that works differently… Let’s try to debug

Can you check if any error message appears in the report window?
Other thing to test is with a file path that has no spaces or special characters in it, does it work any better?
the syntax of dwg2dwg is very simple, so one can also test in a terminal:
C:\path\to...\dwg2dwg.exe -o “C:\path\to\some\file.dxf” “C:\path\to\some\file.dwg”

What I meant: I am interested in seeing a DWG that ODA cannot import properly.

Yes, my experience with ODA is that it’s pretty good. In fact, I think that’s the exact same component used by QCAD pro. Only its interface is annoying, while the one from qcad is silent

here is a posibility for 3D-DWG

https://forum.freecadweb.org/viewtopic.php?f=13&t=48318&start=110#p417264


edit

via ifc


https://www.youtube.com/watch?v=UkLlxGo5ZPE

https://www.youtube.com/watch?v=UkLlxGo5ZPE

On windows, there’s a file called dwg2dwg.bat, which contains the following info:

@echo off
qcadcmd.com -no-gui -allow-multiple-instances -autostart scripts\Pro\Tools\Dwg2Dwg\Dwg2Dwg.js %0 %*

the folder it specifices scrpts\pro\tools\dwg2dwg doesn’t exist, or i cant find it in inside of the qcad folder.

specificying the dwg2dwg.bat file in freecad


tested dwg2dwg.bat in the command prompt and it works:

C:\Users\dimitar\Documents\_apps\qcad-3.27.1-pro-win64\dwg2dwg.bat -o c:\users\dimitar.pouchnikov\desktop\test1.dxf c:\users\dimitar\desktop\test1.dwg
QCAD version  3.27.1
18:44:31: Debug:    Input file:  c:\users\dimitar\desktop\test1.dwg
18:44:31: Debug:    Output file:  c:\users\dimitar\desktop\test1.dxf
18:44:31: Debug:    DXF/DWG Release:  R27
18:44:31: Debug:    calling odInitialize
18:44:31: Debug:    dropped global XDATA (no res buf):  "ViewportCenter"
Warning:  old and new property values for property  "Arrow block"  have different types: QString  vs.  int
Conversion finished.

With the same simple circle DWG file, I get the following error in Freecad:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\dimitar\Documents\_apps\FreeCAD_0.20.26858_Win-LPv12.5.4_vc17.x-x86-64\Mod\Draft\importDWG.py", line 106, in insert
    doc = importDXF.insert(dxf, docname)
  File "C:\Users\dimitar\Documents\_apps\FreeCAD_0.20.26858_Win-LPv12.5.4_vc17.x-x86-64\Mod\Draft\importDXF.py", line 2845, in insert
    Import.readDXF(filename)
<class 'RuntimeError'>: File doesn't exist

I’m on Linux, and pointing on dwg2dwg, create a freeze (or illimited waiting) on Fcad while opening a dwg file. I’ve not tested using it directly by shell console, I’ll try.

Yes base geometry normally is good with ODA, but text, quotation, layers, etc etc, not so good (in my experience, at least). With Qcad I’ve opened some Dwg that ODA was imported not so good (pity I cannot post it here, because these are works/files from other clients, not mine), and Qcad it’s really fast, you can erase things very quickly. What is not good with Qcad, IMHO, is that a lot of times texts imported (only from dwg made with recent Autocad versions) are giant (in my experience, I repeat).

I really hate dwg and lock-in/proprietary standard.

that’s the way it is with me too, so in my opinion freecad will change the cad landscape as radically as linux changed the server landscape.

Thanks for testing guys! What I can gather so far:

  • on windows one has to use the dwg2dwg.bat
  • on linux too, the dwg2dwg util is a bash script. Unded the hood it launches the qcad main executable with the -no-gui option and executes a Dwg2Dwg.js script.
  • the script works on windows too when used in a terminal

So most probably the problem is when FreeCAD calls the dwg2dwg script. I’ll add more debugging info to importDWG.py so we can look further

I’ve tested more (I’m on Linux) the dwg2dwg lib, and yes it works in the end :smiley: (but importing directly in Fcad by Qcad pro lib, it’s really really slow, it’ takes a lot of minutes on my Ryzen7 workstation with 32 GB of ram)

But it import “only” geometry, al text and all layers and other thing in dwg, are gone. So at the end it’s more useful (to get all the info in the dwg), IMHO, to open the dwg with Qcad pro directly, preprocess all the info that you need there (it’s very quickly BTW, Qcad pro it’s really a good SW) and then export to dxf to import in Fcad. It’s not a very good process, because you need a lot of work to setup all in Fcad and continue working on dwg from other people, and I really hate this, but this workaround it’s working.

Of course having more debugging info will be very useful to have a better import. But the big issue here for what I see, IMHO, it’s having a better dxf importer/exporter that can get/send all the 2d info in a Fcad file.

Do you use the legacy python dxf importer?
The newer, c++ one is super fast, specially with the “group layers into blocks” option… Here are my settings:
Screenshot from 2022-01-25 12-50-54.png

usually the dwg is not 1:1, then the text would be unusable when scaling. if you work with image everything is there

test dwg file https://dwgmodels.com/250-apartment-building-facades.html



3.png
4.png
btw: in this example you can see that the beams in dwg files are often cheated

I use the legacy, maybe it’s time to use the newer one!
I’ll test it with your settings, thanks a lot for the tips :slight_smile: