This is probably a really easy thing for lsp, but I don't know it!
I have many floorplans and each room has a polyline around it.
What I'd like to do, is be able to select multiple (or single) polylines and have a dynamic field with the area attached to each polyline placed in the middle (or on a consistent edge, say top left). Preferably with custom units as we use mm for the drawings, but would want the area in m2. Also custom text heights.
Any ideas? I can find a lot of 'put the area in the middle' scripts, but they're either not dynamic or they require a click to place each one - and with over 700 floorplans and over a hundred or more rooms on some, it's not really possible to do each one individually!
Thanks for any help!
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
This is very useful and exactly what I was looking for. I don't have much knowledge of lisp but I was wondering if the lisp can be changed to accommodate decimal instead of a comma in the format. I know I'm a little late to the party but any help would be much appreciated.
Thanks in advance.
EDIT: Sorry. I figured it out via field expression in Field Edit Dialog box (modified lisp attached). Thanks for such awesome lisp routine.
Hi I have same issue and did not get what you did to fix it will you please explain .thanks.
@Anonymous wrote:It's now saying:
'Select objects: 0 found, 0 total
Select objects: 0 found, 0 total
Select objects: 0 found, 0 total'
when I say multiple and click on lines?
Clare
@toomohdi wrote:
Hi I have same issue and did not get what you did to fix it will you please explain .thanks.
@Anonymous wrote:
It's now saying:
'Select objects: 0 found, 0 total
Select objects: 0 found, 0 total
Select objects: 0 found, 0 total'
when I say multiple and click on lines?
Clare
Are you having the same issue as the previous postee [ post 21 ]? decimals and comma? or an entirely different issue? Are you using the code posted at post 21?
thanks for replay,
yes I got same :It's now saying:
'Select objects: 0 found, 0 total
Select objects: 0 found, 0 total
Select objects: 0 found, 0 total'
@pbejse wrote:
@toomohdi wrote:Hi I have same issue and did not get what you did to fix it will you please explain .thanks.
@Anonymous wrote:It's now saying:
'Select objects: 0 found, 0 total
Select objects: 0 found, 0 total
Select objects: 0 found, 0 total'
when I say multiple and click on lines?
Clare
Are you having the same issue as the previous postee [ post 21 ]? decimals and comma? or an entirely different issue? Are you using the code posted at post 21?
@toomohdi wrote:
thanks for replay,
yes I got same :
It's now saying:
'Select objects: 0 found, 0 total
Select objects: 0 found, 0 total
Select objects: 0 found, 0 total'
Hi toomohdi,
You are getting that message because of the selection filter is exclusive for polylines under layer "A-AREA-BDRY".
Either you change layer "A-AREA-BDRY" on the code to some other layer name or put the polylines for selection on aforementioned layer name. OR
just remove this line from the code.
(8 . "A-AREA-BDRY")
HTH
@F.Camargo wrote:
...I'd like to use the text with 1.5 height and 90° rotate as default. 🙂
Replace this
...
(vla-put-AttachmentPoint (setq txt (vla-addMText acsp (setq p (vlax-3d-point (mapcar '/ sum (list verts verts)))) 0 StrField)) acAttachmentPointMiddleCenter)
...
To this
(setq txt (vla-addMText acsp (setq p (vlax-3d-point (mapcar '/ sum (list verts verts)))) 0 StrField))
(mapcar '(lambda (f v) (vlax-put txt f v)) '("AttachmentPoint" "Height" "Rotation") (list 5 1.5 (/ pi 2.0)))
HTH
@pbejse wrote:
@F.Camargo wrote:
...I'd like to use the text with 1.5 height and 90° rotate as default. 🙂
Replace this
...
(vla-put-AttachmentPoint (setq txt (vla-addMText acsp (setq p (vlax-3d-point (mapcar '/ sum (list verts verts)))) 0 StrField)) acAttachmentPointMiddleCenter)
...To this
(setq txt (vla-addMText acsp (setq p (vlax-3d-point (mapcar '/ sum (list verts verts)))) 0 StrField))
(mapcar '(lambda (f v) (vlax-put txt f v)) '("AttachmentPoint" "Height" "Rotation") (list 5 1.5 (/ pi 2.0)))HTH
Thank you very much @pbejse
Now I know how to change the properties of the text.
Fabrício
@pbejse wrote:
@F.Camargo wrote:
...I'd like to use the text with 1.5 height and 90° rotate as default. 🙂
Replace this
...
(vla-put-AttachmentPoint (setq txt (vla-addMText acsp (setq p (vlax-3d-point (mapcar '/ sum (list verts verts)))) 0 StrField)) acAttachmentPointMiddleCenter)
...To this
(setq txt (vla-addMText acsp (setq p (vlax-3d-point (mapcar '/ sum (list verts verts)))) 0 StrField))
(mapcar '(lambda (f v) (vlax-put txt f v)) '("AttachmentPoint" "Height" "Rotation") (list 5 1.5 (/ pi 2.0)))HTH
Now I know how to change the properties of the text.
Thank you very much.
@pbejse wrote:
@toomohdi wrote:thanks for replay,
yes I got same :It's now saying:
'Select objects: 0 found, 0 total
Select objects: 0 found, 0 total
Select objects: 0 found, 0 total'Hi toomohdi,
You are getting that message because of the selection filter is exclusive for polylines under layer "A-AREA-BDRY".
Either you change layer "A-AREA-BDRY" on the code to some other layer name or put the polylines for selection on aforementioned layer name. OR
just remove this line from the code.
(8 . "A-AREA-BDRY")HTH
Thanks, appreciate it.
is it possible to upgrade the lisp to able label all poly lines and calculate area and X,Y,Z and send it to excel or in a table in cad file.
@pbejse Hello there. I was wondering if anyone is still following this post? This lisp appears to be exactly what I'm looking for, however, it's not adding any labels. I loaded the lisp without making any changes, put my "boxes" to test it out on the correct layer, and run the command. When it asks if I want to process all polylines, I say yes. Then the command exits and nothing has happened. Could you provide any insight? Thanks.
Can you Copy/Paste what your command line history says when you run the command?
Best,
~DD
@rebeccac wrote:
It actually doesn't say anything.
It just exits the command, and goes back to the command line prompt.\
Are your "boxes" in fact closed Polylines? That is, not built of [for example] Lines? Are they not on the specific Layer that the routine is written for [see Message 25]?
Is it possible to create a similar function but which considers the area of all the hatch instead of all the polylines?
@rebeccac wrote:
I loaded the lisp without making any changes, put my "boxes" to test it out on the correct layer,
What they said. 🙂
Did you at least get this message "0 Objects found" at the command prompt after nothing has happened?
The program is targetting a specific layer name and the object type Polyline/Lwpolyline and the objects are on Model space
(setq ss (ssget (progn (initget 1 "Y N") (setq ans (getkword "\nProcess All Polylines [Yes/No]: ")) (if (eq "Y" ans) "_X" ":L")) '((0 . "*POLYLINE") (8 . "A-AREA-BDRY") (-4 . "&") (70 . 1)(410 . "Model"))))
If these conditions are met then the MText will appear.
OR the MTEXT is too tiny to see
Paste this on the command prompt right after the running the lisp
(sssetfirst nil (ssget "_X" '((0 . "MTEXT")(1 . "*m²")(410 . "Model"))))
IT should highlight the created MTEXT. if YES, change the TEXTSIZE variable to the desired text height
And yes, the objects might not be a closed polyline.
I just realized I made the layer name BNDY not BDRY. Ai yi yi!! Sorry for the unnecessary question.
*EDIT* I'm also trying to make this read square feet to the whole number with "SF NET" on the end. For some reason, it's just now returning ####.
is there a way to add a second line in the same Mtext that shows acres?
I tried this line but it didn't work.
">%).Area \\f \"%lu2%pr2%ps[, SF]%th44\">%/p>%).Area \\f \"%lu2%pr2%ps[, AC]%ct8[2.295684113865930E-005]%th44">%"
*For now my workaround is running two lisps (PolyAreaSF & PolyAreaAC). After running SF, move those to different layer, run AC then select similar on the AC mtext layer & move all the AC mtext down slightly..
Any tips would be appreciated.
Can't find what you're looking for? Ask the community or share your knowledge.