offset with elevation

Discussion in 'AutoCAD' started by John Coon, Jul 7, 2004.

  1. John Coon

    John Coon Guest

    Need help with a offset routine that I want to add a elevation to the offset
    entities. The current routine offsets a selected entity by the texbox
    values.
    ? how would I change the Z value of the newly created entities to a new
    elevation. The only thing I found that looked like it could work was the
    move function.
    if I use that would I capture the new offset location in a selectionset and
    then move the enitity or can I move it to the z value before the offset. not
    sure how to do either yet. offsetEntities(i).Move? will this work

    Any direction is greatly appreciated
    John Coon

    Sub offset()
    Dim entity As AcadEntity
    Dim textBox1 As String
    Dim textBox2 As String
    Dim textBox3 As String
    Dim textBox4 As String
    textBox1 = "300" 'RSA width
    textBox2 = "800" 'object free area width
    textBox3 = "600" 'RSA beyond rw end
    textBox4 = "600" 'Object free area beyond rw end

    Dim i As Integer
    Dim offset1 As Double
    Dim offset2 As Double
    Dim offsetEntities As Variant
    Dim selectionSet As AcadSelectionSet ' Define the offest distances.
    offset1 = textBox1
    offset2 = (textBox1 * 2) offset2 = (textBox1 - offset2)
    offset3 = textBox2
    offset4 = (textBox2 * 2) offset4 = (textBox2 - offset4)
    ' entities exists.
    Dim objlayer As AcadLayer
    Set objlayer = ThisDrawing.Layers.Add("C-RSA")

    ' Delete the selection set if it already exists.
    For Each selectionSet In ThisDrawing.SelectionSets
    If selectionSet.Name = "CurrentSelection" Then
    selectionSet.Delete
    Exit For
    End If
    Next selectionSet ' Create a new instance of the selection set.
    Set selectionSet = ThisDrawing.SelectionSets.Add("CurrentSelection")
    ' Add entities to the selection set.
    selectionSet.SelectOnScreen ' Create the offsets and put them on the
    correct layer.
    For Each entity In selectionSet
    offsetEntities = entity.offset(offset1)

    For i = LBound(offsetEntities) To UBound(offsetEntities)
    offsetEntities(i).Layer = "C-RSA"
    Next i
    offsetEntities = entity.offset(offset2)

    For i = LBound(offsetEntities) To UBound(offsetEntities)
    offsetEntities(i).Layer = "C-RSA"
    Next i

    offsetEntities = entity.offset(offset3)
    For i = LBound(offsetEntities) To UBound(offsetEntities)
    offsetEntities(i).Layer = "C-RSA"
    Next i

    offsetEntities = entity.offset(offset4)
    For i = LBound(offsetEntities) To UBound(offsetEntities)
    offsetEntities(i).Layer = "C-RSA"
    Next i
    Next entity
    Update
    End Sub
     
    John Coon, Jul 7, 2004
    #1
  2. Hi John,

    As you create each offset object read its elevation, add your change value
    and then change the object elevation to the new one before the update.

    --

    Regards


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Jul 8, 2004
    #2
  3. John Coon

    John Coon Guest

    Laurie,

    That was it!!!! Thanks. I did as you suggested and it now works like a
    charm.

    John Coon
     
    John Coon, Jul 8, 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.