HFSS ImportDXF and ImportAutoCAD

I am currently using 2020 R1 with an institutional license (I am an academic but this is not a student license) and am trying to add DXF/DWG importation support to a Python API module that I have. My license has DXF support (it allows me to import DXF and DWG as well as IGS and STEP) so I know that my license supports the functionality in the GUI. In following the scripting guide's example I wrote a little test function. The first picture is just to convince those reading that the ImportDXF is a valid bound method.

I then followed the example in the scripting help and the code did run, but it did not return anything, either an error or a successful importation (picture 2).


To ensure that it wasn't something in my DXF I did a manual import using the GUI and it successfully imported the DXF file (picture 3), seemingly indicating that the DXF is correctly formatted for importation.

I was puzzled so I played with the parameters and nothing has seemed to work. What is weirder is that the ImportDXF function doesn't respond to any user input, i.e if I pass in an empty parameter list or nonsense parameters it seemingly still runs without any returned error

I have never seen this behavior in any other function, and in any other case I would expect a COM error. For example, if I use the Import function (which I know works with 3D STEP files) then I return the expected COM exception:

I also know the normal Import functionality works in my API wrapper with no issues otherwise (when the correct parameter lists are passed in, of course).

This leads me to a few questions about how this function works and if it is something that may be enabled in the GUI but not in the API. I don't know why this would be the case, and the fact that it is an exposed bound method would indicate otherwise, but this doesn't make sense. Looking at the literature there is also an ImportAutoCAD functionality that works with both DXF and DWG filetypes, but there is not great documentation on the way it works, and I am a bit confused about the .edb file. First, in the scripting help, it gives a VB example:

This example however does not translate to Python (typo maybe?). If I expose the methods from the GetTool object, there is simply an ImporrAutoCAD (with the corresponding inputs from the example in the documentation, as shown in the image below). If I take the above (sans the ImportDXF and instead ImportAutoCAD) as follows (no control file):

The cell runs but I receive this warning message:

And these global messages:

And of course, no imported object whatsoever.


Anyway, for those who have made it this far, is there any information you can give about what is going on here? Neither of these seem to be working as intended, and unlike the normal Import method there seems to be some subtlety to how this works. If anyone has an answer for me, please send me a message. Finally, these are purely 2D objects that are generated from code and into a series of mask files for nanofabrication and then used in HFSS and Maxwell.


Bests,


Andrew

Best Answer

  • aorianiaoriani Member
    Accepted Answer

    I managed to solve my problem, and it was a bone headed mistake. I wrongly assumed (based on the example) that the "TechFileLayers" input array was the array where I declared which layer I wanted to import, where in reality what I wanted was the "LayerInfo" array. It now correctly works, and I wrote a base function for the API around that code. Attached is how it appears in the API right now. It uses ezdxf to parse the file and check th elayers (PYDXF and Defpoints are empty layers that contain other information from the DXF generation using another Python API) and then imports them (or the selected layers) after determining if they are valid. self._modeler is the oEditor object.

    Hope this helps anyone else stuck on this issue.


    ~Andrew

Answers

  • aorianiaoriani Member
    Accepted Answer

    I managed to solve my problem, and it was a bone headed mistake. I wrongly assumed (based on the example) that the "TechFileLayers" input array was the array where I declared which layer I wanted to import, where in reality what I wanted was the "LayerInfo" array. It now correctly works, and I wrote a base function for the API around that code. Attached is how it appears in the API right now. It uses ezdxf to parse the file and check th elayers (PYDXF and Defpoints are empty layers that contain other information from the DXF generation using another Python API) and then imports them (or the selected layers) after determining if they are valid. self._modeler is the oEditor object.

    Hope this helps anyone else stuck on this issue.


    ~Andrew

  • pmunagapmunaga Forum Coordinator

    Hi @aoriani,

    Thanks for reaching to us and sharing your thoughts on this.

    All the best for your future simulations.

    Best Regards,

Sign In or Register to comment.