Results 1 to 7 of 7

Thread: How we get the object property

  1. #1
    Active Member
    Join Date
    2005-02
    Posts
    95
    Login to Give a bone
    0

    Default How we get the object property

    I have some polygons created by Pline, In this polylines some text and points in different layers. I have created program in AutoLISP.

    Autolisp program does

    1. first it will prompt a point inside the polygon, It will create new boundary.

    now entering VBA program

    1. Select last boundary by last object and select everythings in the polygons (Text and points)
    2. now we have selected object in the polygon, we can used them as a previous object.

    (WANT TO GET THE TEXT VALUE AND LAYER NAME OF POINTS ONE BY ONE)

    but My question is how can we I get the property of previous selected object.

    Can any one give me an Idea or VBA Code for me?

    pixlepark96@sancharnet.in

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: How we get the object property

    Quote Originally Posted by avinash00002002
    but My question is how can we I get the property of previous selected object.

    Can any one give me an Idea or VBA Code for me?
    What is so special about the previous selected object?

    If you have created a selection set from your text and points inside the polygon, then you can just iterate this selection set and retreive the desired properties from each entity.
    R.K. McSwain | CAD Panacea |

  3. #3
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: How we get the object property

    this code will set ss to the previous selected objects it will error if there is not previous selected objects

    Code:
    Set ss = ThisDrawing.SelectionSets("CURRENT")

  4. #4
    Active Member
    Join Date
    2005-02
    Posts
    95
    Login to Give a bone
    0

    Default Re: How we get the object property

    Previous selected objects means.

    In AutoCAD we have a boundary command ok,
    I have to pick in the polygon only, it will create new boundary for me, (This function runs in the autolisp)
    then going to VBA it will select by new boundary's vertex means in the polygon.
    now all the objects in the polygon already selected.

    then It can be recall as a previous selected object ok,

    I want the all the selected object property one by one. (like if there is a text = text value , If there is a point = Layer name of point)

  5. #5
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: How we get the object property

    Quote Originally Posted by avinash00002002

    I want the all the selected object property one by one. (like if there is a text = text value , If there is a point = Layer name of point)
    Ok. Let me repeat the second part of my last sentence

    Quote Originally Posted by rkmcswain
    then you can just iterate this selection set and retreive the desired properties from each entity.
    Why does the above method not fulfill your needs?
    R.K. McSwain | CAD Panacea |

  6. #6
    Active Member
    Join Date
    2005-02
    Posts
    95
    Login to Give a bone
    0

    Default Re: How we get the object property

    Sir, I don't know this method you send me a sample for it.

  7. #7
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: How we get the object property

    For this example, I drew and selected a:
    • Circle
    • Line
    • Ray
    • Arc
    • Text
    • Point


    Code:
    Sub demo()
    Dim ss As AcadSelectionSet, item As AcadEntity, str As String
    Set ss = ThisDrawing.PickfirstSelectionSet
    ' The above two lines are just so I can form
    ' a selection set. You are forming one in a different
    ' way, right? 
     For Each item In ss
        Select Case item.ObjectName
            Case Is = "AcDbArc": str = str & "ARC RADIUS = " & item.Radius & vbCrLf
            Case Is = "AcDbText": str = str & "TEXT STRING = " & item.TextString & vbCrLf
            Case Is = "AcDbLine": str = str & "LINE LAYER = " & item.Layer & vbCrLf
            Case Is = "AcDbRay": str = str & "RAY LINETYPE = " & item.Linetype & vbCrLf
            Case Is = "AcDbCircle": str = str & "CIRCLE AREA = " & item.Area & vbCrLf
            Case Else: str = str & "ENTITY FOUND = " & item.ObjectName & vbCrLf
         End Select
     Next item
     MsgBox str
    End Sub
    Which will return the following information



    Summary:
    • Iterate the selection set
    • Check the entity type
    • Query for properties that apply to that entity
    Attached Images Attached Images
    R.K. McSwain | CAD Panacea |

Similar Threads

  1. Lisp to add an MText object that contains an object property
    By sheila.bjerreskov717262 in forum AutoLISP
    Replies: 7
    Last Post: 2013-07-22, 05:58 PM
  2. 2012: Making Property Set For Duct Object Always On
    By chris4455 in forum AMEP General
    Replies: 0
    Last Post: 2012-11-27, 09:02 PM
  3. Double click in object properties box to change property
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2006-06-21, 01:29 PM
  4. Property Data Sets - Object Overrides
    By welk3d-cad1 in forum ACA Wish List
    Replies: 0
    Last Post: 2004-12-23, 03:17 PM
  5. Window and Space Object Property Sets
    By arcadia_x27 in forum ACA General
    Replies: 1
    Last Post: 2004-07-03, 12:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •