Problems with vba

Discussion in 'AutoCAD' started by Cbt Bloy, Feb 19, 2004.

  1. Cbt Bloy

    Cbt Bloy Guest

    Hello
    I try to send object property as argument to a function in vba
    this function must sort objects by "LAYER" or "COLOR"
    but i don't know how to use this argument in the function

    Public Function tri_par ( Aray , value)
    For i = 1 To UBound (aray)
    ..............
    ..........
    objprop = objent.value (where value is equal to "LAYER" or "COLOR")
    doesn't seems to be right

    if it isn't possible, Is there a command that accept dxf code as argument ?
    That irritates me, if I succeeded not, I go back in Lisp

    Thank you to help me.
     
    Cbt Bloy, Feb 19, 2004
    #1
  2. Cbt Bloy

    Ben Guest

    Can this example help?

    Sub MakeRed()
    Set R = ThisDrawing.Layers.Add("Red layer")
    R.Color = acRed
    Dim element as AcadEntity
    For Each element in ThisDrawing.ModelSpace
    If element.Color = acRed Then
    element.Color = acByLayer
    element.Layer = "Red Layer"
    end if
    Next Element
    End Sub

    kr
    Ben
     
    Ben, Feb 20, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.