Perform a divide on a set of lines

Discussion in 'AutoCAD' started by misterblobby, Jul 19, 2004.

  1. misterblobby

    misterblobby Guest

    Does anyone know how to perform a 'divide' on an object inside a selection set?

    What I am trying to do is divide a large number of lines into equal segments by using a block to mark the point where the object is divided.
     
    misterblobby, Jul 19, 2004
    #1
  2. Nathan Taylor, Jul 20, 2004
    #2
  3. misterblobby

    misterblobby Guest

    Thanks Nathan.

    For anyone who's interested, here's the code (probably a bit chunky, but it works!)

    Sub dividemelines()


    Dim sset6 As AcadSelectionSet
    Dim entry As AcadEntity
    Dim myline As AcadLine


    ThisDrawing.Utility.Prompt ("Select lines")
    Set sset6 = ThisDrawing.SelectionSets.Add("SS1111111")

    sset6.SelectOnScreen

    For Each entry In sset6

    Select Case entry.ObjectName
    Case "AcDbLine"
    Set myline = entry
    ThisDrawing.SendCommand "._divide (handent """ & myline.Handle & """) "
    Dim numDivs As Long
    numDivs = 6
    ThisDrawing.SendCommand Format$("B") & " "
    ThisDrawing.SendCommand Format$("c") & " "
    ThisDrawing.SendCommand Format$(Chr(10))
    ThisDrawing.SendCommand Format$("Y")
    ThisDrawing.SendCommand Format$(Chr(10))
    ThisDrawing.SendCommand Format$(numDivs) & " "
    End Select

    Next entry

    sset6.Delete
    Set ss1111111 = Nothing


    End Sub
     
    misterblobby, Jul 20, 2004
    #3
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.