Marcin O Posted June 18, 2022 Posted June 18, 2022 Hello, Is it possible to combine three routines into one to create area description (block attribute with field)? step 1 - find polygon centroids step 2 - replace points with block step 3 - assign block attribute (area field) to polygon I assume its a common task and maybe somone has already created similar routine? I've attached three lisp routines and a test DWG file. Best Regards 1-PolygonsCentroid.lsp 2-Pt2Block.lsp 3-Areas2AttributeV1-2.lsp areas2attribute.dwg Quote
BIGAL Posted June 19, 2022 Posted June 19, 2022 Why not just copy and paste all 3 into one lisp ? 1 Hint centroid can be 1 line of code using a inbuilt function. (setq obj (vlax-ename->vla-object (entlast))) (setq cpt (osnap (vlax-curve-getStartPoint obj) "gcen")) 2 lot of code for insert block ? Just check does exist if not make it as you only need 1 att. I would remove (getstring "\nName of block to insert: ") use a hard coded block name so exists in your DWT. 3 Lee's code is great but as you know the block that you inserted step 2 just edit the attribute with the field answer no need for a total 3rd program. The answer for the att string is in Lee's code. So the steps Select all plines making selection set Loop through selection Insert block at centroid Amend block attribute string value to field Repeat for all plines. Maybe 100 lines of code probably less. I have not posted any code as did you google "label area multiple pline autocad lisp" 1 2 Quote
Recommended Posts
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.