Jump to content

lisp for extracting areas from closed area


emadageeb

Recommended Posts

  • 3 weeks later...
  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    23

  • emadageeb

    8

  • LibertyOne

    7

  • stevesfr

    4

Top Posters In This Topic

Posted Images

Updated to Version 1.7 to fix a minor bug when writing the data to file.

 

Lee

 

Thanks for Lee Mac. It is a very good lisp, but this required to pick the internal point. Is It possible to automatically create the table, no need to pick the point one by one ?

Link to comment
Share on other sites

Thanks for Lee Mac. It is a very good lisp, but this required to pick the internal point. Is It possible to automatically create the table, no need to pick the point one by one ?

 

You're welcome :) To answer your question: no.

Link to comment
Share on other sites

You're welcome :) To answer your question: no.

 

Lee, stop hiding your telepathic function from us, we know you have one! :wink:

Link to comment
Share on other sites

  • 1 year later...

hello Mr. Lee Mac and ALL! great lisp (as long as a basic user can tell) we use it in hugary also, as it seems :) my questions are the following: 1. how can I change the label in the selected area: 1; 2; 3 etc. The text size is 0.2 for me, and I would need at least 2 or 3 so I can read it straight away. 2. how to change lisp so I can use an existing text on the drawing with a with a mouse click for labelling the area in the table (and in selected area too if easier that way), instead of adding automatically 2,3,4, etc.?? if anyone could help please! thanks you! zoli

Link to comment
Share on other sites

hello Mr. Lee Mac and ALL! great lisp (as long as a basic user can tell) we use it in hugary also, as it seems :)

 

Thank you sparkyzol, I'm glad you find it useful even in Hungary :)

 

1. how can I change the label in the selected area: 1; 2; 3 etc.

 

The label text may have a prefix or suffix appended to the incrementing number by altering the appropriate variables under the 'Adjustments' section at the top of the program source code, where noted.

 

The text size is 0.2 for me, and I would need at least 2 or 3 so I can read it straight away.

 

The height of the text is dependent on the value of the TEXTSIZE System Variable in the drawing in which the program is run.

 

2. how to change lisp so I can use an existing text on the drawing with a with a mouse click for labelling the area in the table (and in selected area too if easier that way), instead of adding automatically 2,3,4, etc.?

 

This is certainly possible, however it is not such a quick modification to the program, so you may have to stick with manually altering the label text to suit. As noted above, the 'Adjustments' section of the code offers some customisation options for the label & area text.

Link to comment
Share on other sites

  • 3 months later...

hi LEE

I am from Jordan

I like you Area to field and area table

I hope you inform me how we can change 0 or 2 decimal instad instead then 4 decmal

area 45.24 instead 45.2435

Link to comment
Share on other sites

I hope you inform me how we can change 0 or 2 decimal instad instead then 4 decmal

area 45.24 instead 45.2435

 

The program currently uses the setting of the LUPREC system variable in the active drawing to determine the precision when generating text output, and the Field Formatting code specified within the 'Adjustments' section at the top of the code to determine the precision when generating Field output.

 

To alter the Field output to use decimal units with a precision of 2 decimal places, change the Field Formatting code at the top of the program to:

 

"%lu2%pr2"

If you wish to override the precision for text output and don't want to change your LUPREC system variable, change the following lines of code to include the [highlight]highlighted[/highlight] section:

 

Lines 286 & 409:

(strcat ap (rtos (* cf (vla-get-area p1)) 2 [highlight]2[/highlight]) as)

Lines 318 & 441:

(vla-settext tb n 1 (strcat ap (rtos (* cf (vlax-curve-getarea el)) 2 [highlight]2[/highlight]) as))

Line 507:

(write-line (strcat pf (itoa *al:num) sf de ap (rtos (* cf (vla-get-area p1)) 2 [highlight]2[/highlight]) as) of)

Line 523:

(write-line (strcat pf (itoa *al:num) sf de ap (rtos (* cf (vlax-curve-getarea el)) 2 [highlight]2[/highlight]) as) of)

Link to comment
Share on other sites

Q:I hope you inform me how we can change 0 or 2 decimal instad instead then 4 decmal

area 45.24 instead 45.2435

 

I was delete my question

 

thank you me lee for you answer.

 

you are intelligent , clever , smart ....

Link to comment
Share on other sites

  • 1 year later...
To alter the Field output to use decimal units with a precision of 2 decimal places, change the Field Formatting code at the top of the program to:

 

"%lu2%pr2"

 

Hi Lee Mac, great lisp, thank you.

 

Regarding the altering of precision, I did the "%pr2" alteration but without changing the "%lu6" part, and it worked although the main file unit variable had not been changed. So I presume there is no need to change each lines of code by adding the "2", just the %pr2 does it well enough.

 

Still I have a problem with the Adjustments part: namely the params for the Area didn't work for me. I've changed this part:

        ap ""            ;; Area Prefix (optional, "" if none)
       as ""            ;; Area Suffix (optional, "" if none)
       cf 1.0           ;; Area Conversion Factor (e.g. 1e-6 = mm2->m2)

into

        ap "P="            ;; Area Prefix (optional, "" if none)
       as " m2"            ;; Area Suffix (optional, "" if none)
       cf 1e-4           ;; Area Conversion Factor (e.g. 1e-6 = mm2->m2)

wanting my centimers drawing to give out the area in m2, with prefix "P=" and suffix " m2", and it did absolutely nothing.

 

The part of code regarding the Number prefix/suffix did work though (I have a standard prefix), so I am puzzled...

 

I finally made an adjustment to the Area field formatting, and made the converion/prefix/suffix work, a type of workaround:

fo "%lu6%qf1%pr2%ps[P=, m2]%ct8[1e-004]"    ;; Area field formatting

So, if anybody has a similar problem as mine, this should work (adding the "%pr2" for 2-digits precision, the "%ps[_prefix_,_suffix_]" for prefix and suffix and "%ct8[1e-004]" for conversion from cm2 into m2).

 

I'm also looking at a possibility to unify your two lisps (area label and area to field) into one, in order to have the area both in the table and in the Mtext below the Number title (so on both places). If I succeed (doubtful, as I'm absolutely new to lisp) I'll share it with you, might come in handy.

Link to comment
Share on other sites

Hi z00ey,

 

Still I have a problem with the Adjustments part: namely the params for the Area didn't work for me. I've changed this part:

        ap ""            ;; Area Prefix (optional, "" if none)
       as ""            ;; Area Suffix (optional, "" if none)
       cf 1.0           ;; Area Conversion Factor (e.g. 1e-6 = mm2->m2)

into

        ap "P="            ;; Area Prefix (optional, "" if none)
       as " m2"            ;; Area Suffix (optional, "" if none)
       cf 1e-4           ;; Area Conversion Factor (e.g. 1e-6 = mm2->m2)

wanting my centimers drawing to give out the area in m2, with prefix "P=" and suffix " m2", and it did absolutely nothing.

 

These parameters only apply when 'picking' areas (as opposed to selecting objects), since the boundary of an area determined by an internal point may consist of multiple objects and hence cannot be represented using a field (without adding a new object representing the boundary to the drawing).

 

When fields are created, all formatting is determined by the field formatting parameter, as you have gathered.

 

I'm pleased you find the program useful.

 

Lee

Link to comment
Share on other sites

Of course! I just didn't try it with picking points as I needed the areas of objects (namely closed plines). Made myself two different versions, one with standard units displayed, and one with 1/100 units displayed (cm2 into m2, with precision of 2 decimals) so I can load the one I need at the moment. In the second I included the changes in the 6 lines by adding "2" at the proper place, and now it works both with fields for objects and with plain text for picking points (but cannot be updated). Thanks again!

 

Do you feel it would be hard to incorporate the area2field lisp way of putting fields inside the areas together with the fields in tables of arealabel lisp, but just talking about the objects (and not the pick point part)? Been trying yesterday but am just unable to understand the code (my ignorance, not your code)?

Link to comment
Share on other sites

  • 3 years later...

Hi everyone, sorry to bring this up after 3 years

 

This is the second time i type this. The first time i refreshed my page or something and i lost it all.

Anyways

 

I was wondering if wit is possible to make a lisp that, instead of opening a new excel file, uses an already opened excel file that was opened even before using the command.

 

when we use Lee Mac´s lisp "AreaLabelV1-7" and use the "areas to file,,, AF" command, we get a window to create a new excel file (i will talk about excel only) and then we get our areas in there, a new brand excel file made from scratch. But what if we need our areas in an excel file that is already opened (and even maybe unsaved), and in the last clicked cell too. I saw that when we use the "AF" command, it always creates a new file and it exports the information to the first cells/columns.

 

I found on the internet a .vlx command called "Click2XLS.vlx", that does almost what i mean (it is a .vlx so i can not see the code).

I say almost because it opens a new excel file too, and the first time you use it, it exports the information to the first cells too, but if you click some other cell of that file, and use the command again, you get the information in that last clicked cell.

 

I already have a .vba command that does what i am talking about (exports areas to an already opened unsaved excel file, to the last clicked cell), but i would like to know if it is possible to have the same in a lisp command.

 

Thanks in advance to anyone who responds, and i am sorry if i dont make myself clear or if i am being too complicated.

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...