Jump to content

calculate area of a specific layer


jomer

Recommended Posts

Hi all!

 

i need a VBA code for calculating area of a specific layer

 

i have a code for calculating an area but it just computing the whole objects and polyline in the model space

 

Your help will be really much appreciated

 

Best Regards,

Jomer

abc.png

Edited by jomer
Link to comment
Share on other sites

Are you asking for a boundary area of the 1layer , not individual objects ? 

 

If this is the case there are just so many different ways of interpreting the answer depending on the interactivity of the shapes involved.

Link to comment
Share on other sites

Thank you for your concern sir

 

Yes sir, i'm referring to the area of 1 layer, not individual objects

 

 

This is the code i get in computing the area but for the whole model space

 

Public Function GetTotalPolylineArea() As Double

  Dim area As Double

  Dim ent As AcadEntity

  Dim pl As AcadLWPolyline

    
  For Each ent In ThisDrawing.ModelSpace

    If TypeOf ent Is AcadLWPolyline Then

      Set pl = ent

      area = area + pl.area

    End If

  Next

  GetTotalPolylineArea = area
  

End Function

 

 

Sir i have list of layers in combobox

The problem is how can i get the area of the layer i choose in that combobox

 

 

 

Thank you sir in advance :D

 

Edited by jomer
Link to comment
Share on other sites

  • 4 weeks later...

'Im referring to the area of 1 layer, not individual objects '

 

Layer as layer doesn't have area, but you can calculate area of elements on layer, but again, not for all. Point, text doesn't have area. Layer is just property of any object, just as collor (entity is word we usualy use)

Link to comment
Share on other sites

  • 3 weeks later...

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