Skip to main content

Solved with LISP (.lsp) and csv export. Read my last post

 

I working on a script that need to test some parameters in a hundres of dwg files.

Just to make it short. Autocad_layer_frozen and Autocad_layer_description are two attribute that I need to check and what I use in this example.

 

However, the only way I have succeeded so far to get empty layers visible is to use a dwg reader and choose individual file types. B No data of course. Nothing is read since the layer is empty.

 

Both DWG reader and feature reader can only read layers that are not empty.

 

Feature reader and with format "Any schema" can read all layers, also empty layers, but does not contain the native autocad attributes like Autocad_layer_frozen and Autocad_layer_description.

 

Is there any way to read empty layers to get all the attributes that exist in a autocad layer feature with only use of FME?

I do not think this can be done with native FME tools. If I needed this I would try to do this using the PythonCaller. Found pyautocad when searching, but have not tried it myself.


I do not think this can be done with native FME tools. If I needed this I would try to do this using the PythonCaller. Found pyautocad when searching, but have not tried it myself.

Hi Niels, Thanks. Yeah, I was think on PyAutocad. But I think it can be an issue since we need to run on FME server. There will be other challenges instead.

I am also thinking in a workaround to run a LISP script first and add the lisp to the FME script.


Hi Niels, Thanks. Yeah, I was think on PyAutocad. But I think it can be an issue since we need to run on FME server. There will be other challenges instead.

I am also thinking in a workaround to run a LISP script first and add the lisp to the FME script.

I think it is possible to get custom libs running in server?


Think so . That would be something to add to the todo. Can be useful


I have solved it like this.

  1. Created a LISP file for autocad that exports all layer information regardless if the layer is empty or not.

image.png 

  1. Added a generic reader where i paste multiple dwg + csv
  2. split the input data with a tester. One for CSV and one for DWG ( the rest) image
  3. The sampled the data. Just need one feature per filename to use in the next step as indata for feature readers
  4. And then 2 featurereaders. One for the dwg and one for the csv where input data is fme_dataset ( file source path ) image
  5. And in the next step I can compete these indatat in se what layers are empty. But also get the information I was missing in the empty layers

So now I am working on a bat file that can batch the layer list from all layers in the same folder. My thought here is. One click on the .bat runs the LISP that exports a csv per dwg file. Unfortunately I cant share more of the script since its developed to a costumers. But I want to share this workflow since I think its a good way to get all data from the DWG layer name. Even for empty layers.

 

There are probably more solutions. For boot FME server and local you can probably use pyautocad to get the information.But I need a quick solution that are stable. One more click and a fiew more files to drop.


I have solved it like this.

  1. Created a LISP file for autocad that exports all layer information regardless if the layer is empty or not.

image.png 

  1. Added a generic reader where i paste multiple dwg + csv
  2. split the input data with a tester. One for CSV and one for DWG ( the rest) image
  3. The sampled the data. Just need one feature per filename to use in the next step as indata for feature readers
  4. And then 2 featurereaders. One for the dwg and one for the csv where input data is fme_dataset ( file source path ) image
  5. And in the next step I can compete these indatat in se what layers are empty. But also get the information I was missing in the empty layers

So now I am working on a bat file that can batch the layer list from all layers in the same folder. My thought here is. One click on the .bat runs the LISP that exports a csv per dwg file. Unfortunately I cant share more of the script since its developed to a costumers. But I want to share this workflow since I think its a good way to get all data from the DWG layer name. Even for empty layers.

 

There are probably more solutions. For boot FME server and local you can probably use pyautocad to get the information.But I need a quick solution that are stable. One more click and a fiew more files to drop.

So you can run the LISP routine using a .bat file? Be informed that you can also do this using a SystemCaller to automate this process further.


So you can run the LISP routine using a .bat file? Be informed that you can also do this using a SystemCaller to automate this process further.

Thank you. ⭐️

To be able to run the bat with the .lsp the users can do it since they have autocad installed. Since the script should be run on FME server we need to install Autocad on the server or some other way so FME understand there is a autocad license. Have not done that yet and dont know how the Autocad license will affected when multiple users running the script. The users will not run FME desktop, only server ( flow).

 

I appreciate your tip and will look into the system caller further. Its a really great input.


So you can run the LISP routine using a .bat file? Be informed that you can also do this using a SystemCaller to automate this process further.

Good point 🙂 I have not done this on server so I do not know how it should react. I think something more affordable like bricscad might run LISP as well? And I think multiple users running it would probably more an ELA than a technical problem.


Reply