Notifications
Clear all

[Closed] Maxscript read DWG properties before import

 em3

Hello! Is it possible to read the properties of the DWG before importing? Reason being is that the dwg I am importing has database “intelligence” behind it.

So basically, I need to get the value of a property in the dwg file and then name the imported object with this property name. Not sure if you have to call some kind of lisp function in Max or what. My question is, is this possible?

Thanks!

3 Replies

As far as I know it is not possible to do that directly with maxscript.
All you can do is importing a DWG file with the same possibilities the DWG import dialog offers.
However, if there is a command line tool to read out those values, it would be easy to call it from a script and get the result.

 em3

plastic, thanks for your reply!

The only field I think I need is the Name field. This is what I am thinking…

Maxscript calls dwg import
dwg object is selected, maxscript passes that objects data to a dll
dll reads that objects data and returns a variable I can plug into the name field.
Import grabs dwg object geometry
When object import is complete, the variable returned from the dll is plugged into the name field.

Does that sound possible?

When importing DWG you’ll get the name of each object and the layer it resides in.
You can easily create an array of the names and store it into a list text file, for example.
Then you start your external tool from maxscript with that list as parameter.
The tool modifies the list, after that it is parsed back by maxscript, as a new array.
Now you loop through the original array of imported objects and rename them, based on the new data.
That’s how I’d do it.

I guess you can use dotNet and a dll, to pass data without having to write to files, etc, but I’m not sure how this works.