I’m relatively new to VIKTOR and currently exploring its capabilities to automate and optimize my engineering design processes. I’m reaching out to tap into the collective wisdom of this community as I have a few questions related to integrating VIKTOR with AutoCAD, and more specifically, Civil3D.
My project involves a substantial amount of .DWG and .DXF files from AutoDesk Civil3D, and I’m exploring the best ways to incorporate these files within the VIKTOR platform.
Here are my queries:
- Has anyone successfully imported .DWG or .DXF files from Civil3D into VIKTOR? If yes, I would appreciate it if you could share the process or any pointers on how to achieve this.
- Once the files are imported, is it possible to make edits directly within VIKTOR? I’m interested to know your experience in doing so.
- Finally, is it feasible to export these edited files back into Civil3D? Any insights or workarounds to achieve this would be helpful.
Please note, I understand that the AutoDesk API does not support .DWG to .DXF conversion by design, which is often an exchange format. So, I’m primarily seeking advice that doesn’t rely on this method.
I truly believe that your experiences and advice could be instrumental in my project and be of immense help to others in similar situations
Hi obfusticatedcode,
Thank you for your question. Unfortunately, .DWG files are a closed-source proprietary format from AutoCAD, making it very difficult to work with .DWG files directly outside of AutoCAD. This is probably why you will find more information online about working with .DXF files and python online.
For DXF files, I have personally used the python package ezdxf · PyPI to read, edit and generate .DXF files. Below you can find a snippet on how to read a DXF file in VIKTOR
kind regards,
Paulien
import os
from pathlib import Path
from tempfile import NamedTemporaryFile
import ezdxf
from viktor import File
def read_dxf(dxf_file: File):
# create temprary file
temp_file = NamedTemporaryFile(suffix=".dxf", delete=False, mode="wb")
# write file content to this file
temp_file.write(dxf_file.getvalue_binary())
temp_file.close()
path_out = Path(temp_file.name) # get path to the temp file
dxf_data= ezdxf.readfile(path_out) # load the file into ezdxf
os.remove(temp_file.name) # delete temporary file
return dxf_data
1 Like
Hi Paulien,
Thank you for taking the time to respond to my queries. I appreciate your insights on the challenges of working with .DWG files and your suggestion of using the ezdxf Python package to handle .DXF files in VIKTOR.
However, I think there may have been a slight misunderstanding about my original inquiry. I was exploring the possibility of creating a more direct integration between Civil3D and VIKTOR. Ideally, I was looking for a solution that could seamlessly transition files between the two platforms, allowing me to make edits and adjustments in VIKTOR before sending the files back to Civil3D.
Based on your response and some further research, it seems like this kind of integration might not be entirely possible with VIKTOR due to the proprietary nature of .DWG files and the specific capabilities of Civil3D and VIKTOR.
While VIKTOR offers an impressive range of features for automating and optimizing engineering design processes, I think for this specific project I may need to look into different solutions or workflows that better cater to my needs.
I appreciate the help you’ve provided, and I will certainly keep VIKTOR in mind for future projects where it might be a better fit. Thanks again for your time and support.
Hey,
As for the export, we once made a civil3d export with Viktor and Dynamo. We did the road design in VIktor. Then, using the Viktor nodes in Dynamo, we recreated the viktor design in Civil3d in 3d.
If you want it 2d, you seem to have DXF import capabilities in dynamo. I have zero experience with this but that might be a thing to look at. DXF Import and Export - Dynamo BIM
As for the import part you want, that is hard. I think DXF files are your best shot here.
3 Likes