Script to convert CAD to Revit runnning into issues with dxf exports

Script to convert CAD to Revit runnning into issues with dxf exports

crapai
Advocate Advocate
375 Views
3 Replies
Message 1 of 4

Script to convert CAD to Revit runnning into issues with dxf exports

crapai
Advocate
Advocate

I'm using dxf exports to grab text information for a pyRevit script that converts our CAD details to Revit. It has been working fine but I have found a file that seems to be creating very strange measurements for the text.

 

This is how I expect the dxf export to look like for a 9 character string text. The string is "(TYPICAL)". The width under 41 is 59.58870056497174. The X and Y under 10 and 20 is 207.7002639875136 and 164.4406971268886.

MTEXT
  5
E7
330
A6
100
AcDbEntity
  8
E-TEXT
100
AcDbMText
 10
207.7002639875136
 20
164.4406971268886
 30
0.0
 40
7.999999999999998
 41
59.58870056497174
 46
0.0
 71
     1
 72
     1
  1
(TYPICAL)
  7
Simplex_2
 73
     2
 44
1.125730921843912
1001
REVIT
1002
{
1070
     1
1000
5355169
1002
}
1002
{
1070
     5
1000
5355128
1002
}
1002
{
1070
     3
1000
5355152
1002
}
  0

 

This is the export from the troublesome file. ALL of the values appear to be much smaller. For example the text width under 41 is only 0.628779109054051. Is there some kind of value I should be looking for in the dxf file to correct for this. The CAD files have the same LTscale but in Revit I have to set the view for this file to 12" = 1' 0" instead of our standard 1/8" = 1' 0".

MTEXT
5
109
330
9B
100
AcDbEntity
8
E-TEXT
100
AcDbMText
10
2.600759081239662
20
-1.435012770780268
30
0.0
40
0.0833333333333333
41
0.628779109054051
46
0.0
71
2
72
1
1
ALUMINUM
7
Simplex_3
73
2
44
1.125730921843912
1001
REVIT
1002
{
1070
1
1000
5353560
1002
}
1002
{
1070
5
1000
5353531
1002
}
1002
{
1070
3
1000
5353544
1002
}
0

 

0 Likes
376 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

For a quick and dirty DIY solution, you could check whether the factors relating the expected and unexpected values are all the same. If they are, you are in luck and can fix them by multiplying with the inverse, without understanding or caring what caused the issue.

   

Oh dear... they seem to differ:

  

a40small=0.0833333333333333
a40large = 7.999999999999998
a40large / a40small
    96
a10l=207.7002639875136
a10s=2.600759081239662
a10l/a10s
    79.86140104
a41s=0.628779109054051
a41l=59.58870056497174
a41l/a41s
    94.76889373

    

A better approach would be to understand what is causing this, which you are attempting to address with your question. Obviously this is caused by something in the generating program, some setting, presumably, possibly a setting in the user interface. So, it is probably not related to either Revit or the Revit API in any way. Who or what is generating these DXF files, and how, exactly?

   

One generic thing to check for that often occurs in different contexts: is this is caused by some unit conversion? A popular one is metric to imperial, or vice versa. However, with differing factors, it must be due to other causes.

   

Conclusion: sorry, no idea.

   

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 4

jeremy_tammik
Alumni
Alumni
0 Likes
Message 4 of 4

crapai
Advocate
Advocate

I'm exporting the dxf using pyRevit. This is the code. I think it is some weird setting in the dwg file.

 

# Export DXF
views = List[ElementId]()
views.Add(cView.Id)
path = "X:\Revit\\03 Script Running"
name = "CADConvertText"
dxfFileCreation = doc.Export(path, name, views, DXFExportOptions())
dxfFile = path + "\\" + name + ".dxf"

 

0 Likes