Jump to content

Closed polyline Area values to Excel


Butch

Recommended Posts

Hello people.

 

In the picture attached you can see 3 polylines where each polyline encloses an area. Could those 3 area values be exported to excel each in its own row?

s1.jpg

Link to comment
Share on other sites

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

  • fixo

    14

  • Butch

    7

  • viviancarvalho

    5

  • xxfaxx

    2

Top Posters In This Topic

Posted Images

Hello people.

 

In the picture attached you can see 3 polylines where each polyline encloses an area. Could those 3 area values be exported to excel each in its own row?

Just changed a few lines in previous code :)

(decimal separator added)

 

~'J'~

AreasToXL.LSP

Link to comment
Share on other sites

Hello fixo:D

 

Small problem.

I have 3 objects in Autocad, 2 areas in Excel and the 3rd is the sumation of 3 areas, but one area is missing.

Couadl you make this only to show area values, no summation in Excel?

a1.jpg

a2.jpg

Link to comment
Share on other sites

Hi,

 

These should get you the area measurment, and put it in a CSV file. It will be located in the drawing directory of the drawing you ran the routine from. You will want to replace or remove variables BldgName, FloorLevel, and TextString in the write_line code to match what your needs. Note that I did no error handling, if you pick an object with no area the routine may fail.

 

(defun AreaCSV ( / File File_ID PlineSelSet PlineArea)
(setq File (strcat (getvar "DWGPREFIX") (getvar "DWGNAME") ".csv"))
(setq File_ID (open File "a"))
(while (/= (setq PlineSelSet (ssadd (car (entsel "Select a Closed Polyline for Area Calculation. ")))))
  (command "._area" "O" PlineSelSet)
  (setq PlineArea (getvar "area"))
  (write-line (strcat BldgName "," FloorLevel "," TextString "," (getvar "area")) File_ID); Example, replace with your variables.
); while
(close File_ID)
); Defun

 

Let me know if you need any help.

 

Have a good one.

Shawndoe

Link to comment
Share on other sites

Fixo, I tried againg using the lips, but eg. if I have 7 areas enclosed by objects, I always get only 2 rows+3rd is the sum in Excel :-(

Can you fix this maybe?

Link to comment
Share on other sites

Hello fixo:D

 

Small problem.

I have 3 objects in Autocad, 2 areas in Excel and the 3rd is the sumation of 3 areas, but one area is missing.

Couadl you make this only to show area values, no summation in Excel?

Sorry my bad :)

I forgot to increment the last row in the routine above

Attached is without total summ sorted by ascending

 

~'J'~

AreasToXL_V2.LSP

Link to comment
Share on other sites

Fixo, can you remove the ascending order and make it to write areas according to geometry that you have in Autoacd.

Like in the first post, 3 areas one under another you get 3 vaules in excel corresponding to each shape.

I will always have geometry one under another!

Link to comment
Share on other sites

Fixo, can you remove the ascending order and make it to write areas according to geometry that you have in Autoacd.

Like in the first post, 3 areas one under another you get 3 vaules in excel corresponding to each shape.

I will always have geometry one under another!

 

Ok, I've changed it to your needs

 

~J~

AreasToXL_V3.LSP

Link to comment
Share on other sites

  • 2 weeks later...
Ok, I've changed it to your needs

 

~J~

 

Hey Fixo!

Sorry for the long delay. Been sick and was away for a short time. Everything fine now.

I tried the lsip again an it working like I asked you but small problem:(.

The order you get values in excel is opposite from the geometry you have in Autocad eg. I have valus in autocad 4,3,5,7,8 (geometry is one under another), in Excel i have 8,7,5,3,4.

Can you reverse this?

Thanx

Link to comment
Share on other sites

Hey Fixo!

Sorry for the long delay. Been sick and was away for a short time. Everything fine now.

I tried the lsip again an it working like I asked you but small problem:(.

The order you get values in excel is opposite from the geometry you have in Autocad eg. I have valus in autocad 4,3,5,7,8 (geometry is one under another), in Excel i have 8,7,5,3,4.

Can you reverse this?

Thanx

 

Glad you've healed, guess now is my time for that :)

 

Ok, I will try but without hurry

 

~'J'~

Link to comment
Share on other sites

Glad you've healed, guess now is my time for that :)

 

Ok, I will try but without hurry

 

~'J'~

 

Fixo:

why do I get the following error?

 

Select objects: 1 found

Select objects: ActiveX Server returned the error: unknown name:

UseSystemSeparators

Command:

 

why is program asking for "UseSystemSeparators" what does it mean?

steve

Link to comment
Share on other sites

Fixo:

why do I get the following error?

 

Select objects: 1 found

Select objects: ActiveX Server returned the error: unknown name:

UseSystemSeparators

Command:

 

why is program asking for "UseSystemSeparators" what does it mean?

steve

 

"UseSystemSeparators" is from Excel settings, that means

how it will be separated decimals (comma or dot etc)

Open Excel

Open Settings - you will see it there

I used Excel 2003

 

~'J'~

Link to comment
Share on other sites

The order you get values in excel is opposite from the geometry you have in Autocad eg. I have valus in autocad 4,3,5,7,8 (geometry is one under another), in Excel i have 8,7,5,3,4.

Can you reverse this?

Thanx

 

I added a few lines of code

Check it again

 

~'J'~

AreasToXL_V4.LSP

Link to comment
Share on other sites

Hello

This is a pretty good program. It is of great use to me also. Thanks for that.

Can someone help me by just adding up some more lines to it please !!!!!!!

 

Right now if you end the program & run it again in the same dwg,a new excel file is created.

Can something be done to it that the area of the new closed pline be included in the same excel file. I mean one excel file for one dwg.

One more thing : when i select a closed pline insert a text say "Room 1" & this reference also mentioned in the excel file.

 

Regards

Vivian.

Link to comment
Share on other sites

Hello

This is a pretty good program. It is of great use to me also. Thanks for that.

Can someone help me by just adding up some more lines to it please !!!!!!!

 

Right now if you end the program & run it again in the same dwg,a new excel file is created.

Can something be done to it that the area of the new closed pline be included in the same excel file. I mean one excel file for one dwg.

One more thing : when i select a closed pline insert a text say "Room 1" & this reference also mentioned in the excel file.

 

Regards

Vivian.

 

Please, create Excel file manually just insert a few rows

and post it here

I need to see how it will be looks like

There is not clearly enough for me yet

 

To save file with different names you can use this

code block instead:

   (vlax-invoke-method
     abks
     'SaveAs
     (strcat (getvar "dwgprefix")(vl-filename-base (getvar "dwgname")) ".xls")
     -4143
     nil
     nil
     :vlax-false
     :vlax-false
     1
     2
     )

 

 

~'J'~

Link to comment
Share on other sites

Hi Fixo

Thanks for your quick reply.

I dont want the program to create a new excel file everytime i use this program.

it should add the data to the existing file itself.

 

In the attached jpeg "ROOM 1" , "ROOM 2" , "ROOM 3" is the text (eg only) which needs to be input in the closed pline selected in the dwg & the same reffered to in the excel file. Would be greatful if you could do it for me.

AC LAYOUT-Model.jpg

Link to comment
Share on other sites

Hi Fixo

Thanks for your quick reply.

I dont want the program to create a new excel file everytime i use this program.

it should add the data to the existing file itself.

 

In the attached jpeg "ROOM 1" , "ROOM 2" , "ROOM 3" is the text (eg only) which needs to be input in the closed pline selected in the dwg & the same reffered to in the excel file. Would be greatful if you could do it for me.

 

Ok, clearly as mud

Will try

 

~'J'~

Link to comment
Share on other sites

Hey Fixo you have done a big thing for me.

thanks for that. Is it further possible that only one excel file be created for one particular dwg & when some more closed plines are selected, their areas appear in the same excel files. Sorry to trouble you again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...