Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

an automation that requires excellent knowledge of the language

f_rivaXGG6C
Contributor

an automation that requires excellent knowledge of the language

f_rivaXGG6C
Contributor
Contributor

I know this might be an insane request, but I have tried several times, step by step, but always ended up throwing my head against a wall.

If possible, please give me advice on how to do this, or (better for me honestly) an already working lisp file

in case you have any lsp programs that can help me do this, please include as many descriptions as possible so that I can also figure out how to proceed on my own

things to take into account:
- I have autocadLt
- this program must also be run by people who do not have autocad in the English version (I have found that to make it work anywhere, you just have to put the ‘_’ sign before any command) (example: ‘_command-in-English’)

What I need:
# counts:
- for each block, indicate layer and quantity
- if there are polylines, indicate per layer, colour and thickness a sum of lengths (except those in the ‘countlayer’ layer)
- if there is nothing, do nothing

# format:
- 2 charts: one for blocks and the other for lines
- the chart for blocks must have 4 columns: area*, block name, layer, quantity
- the polilynes chart must have 5 columns: area*, thickness, layer, colour, length
- the counts must be divided into *areas specified by a polyline closed in a specific layer (let's call it ‘countlayer’)
- as the first column of the chart for each area, there must be a text specified by a text in the ‘countlayer’ layer within the area specified by the polyline, the text must be composed as follows: ‘count: *’. where the symbol ‘*’ indicates the content that is to be displayed as an inscription in the first column of the chart. If the text is missing, stop program execution and warn that it is missing before starting to count any area
# saving:
- the tables must be saved in an excel table in the same folder as the dwg file
- the file must be saved with a name in yymmddnn format: last 2 numbers of the year, month, day and progressive number starting with 00 that increments each time you run the command on that day


i know this is difficult, so thanks in advance for any tips you can give me

0 Likes
Reply
729 Views
8 Replies
Replies (8)

LDShaw
Advocate
Advocate

I don't have lt so I could be off.

I think you are asking for a DATAEXTRACTION with your own names?

Here is typically the way I create my dated files. Do you want something like this.

 

 

;; create the format date
(setq dwgDir (getvar "dwgprefix"))
(setq currentDate (rtos (getvar "cdate") 2 5))
(setq formattedDate (strcat (substr currentDate 1 4) "-" (substr currentDate 5 2) "-" (substr currentDate 7 2)))

;; Define the CSV file name and create the file
(setq fileName (strcat dwgDir "Data-" formattedDate ".csv"))
(setq fileHandle (open fileName "w"))

;; Write sample data to the CSV file
(write-line "Sample Data,Column 1,Column 2" fileHandle)
(close fileHandle)
(prompt (strcat "\nCSV file created: " fileName))

 

 

0 Likes

ec-cad
Collaborator
Collaborator

Here are a few examples of extracting certain elements, and reporting to a .csv file

they were written for another person in this Forum. You can tune them as desired.

 

ECCAD

0 Likes

MrJSmith
Advocate
Advocate

This is probably not possible in LT. I don't think you can use VLAX manipulation of Excel with LT. You might be able to use LT to export the data to a text file and run another script to generate your Excel charts of the data.

0 Likes

f_rivaXGG6C
Contributor
Contributor

thanks for the tips, I will try to put something together
if you also have other commands or systems that you know may be useful to me, please don't hesitate, I'm also doing this to better understand how this language works and the commands I can use

0 Likes

f_rivaXGG6C
Contributor
Contributor
I did a search... it seems I can use that command
0 Likes

MrJSmith
Advocate
Advocate

Which command specifically? Can you do....

(setq excel (vlax-get-or-create-object "Excel.Application"))
(setq sheet (vlax-get-property excel 'ActiveSheet))
(vlax-dump-object sheet nil)
0 Likes

Sea-Haven
Mentor
Mentor

The "get application" method is not supported in LT2024, LT2025 ? So must use make a CSV.

(setq excel (vlax-get-or-create-object "Excel.Application"))

 Bricscad supports it and has done so for years.

0 Likes

MrJSmith
Advocate
Advocate

That is what I thought. And yes, BCAD is great as a low cost scripting platform. 

0 Likes