See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: my block dinamic hatch can not change length and angle

  1. #1
    Login to Give a bone
    0

    Default my block dinamic hatch can not change length and angle

    i have code to dinamic block using hatch but while distance1 is changed and angle1 is changed
    my hatch can not update distance1 and angle1
    please help every body
    Code:
    Sub test1()
     Dim j  As String, Sudut As Double, jarak As Double
     Dim a As AcadBlockReference
     jarak = ThisDrawing.Utility.GetString(1, vbCrLf & "Masukkan Jarak: ")
     x = ThisDrawing.Utility.GetPoint(, "Klik titik awal")
     jarak = CDbl(jarak)
     Sudut = Atn(1)
     Set a = ThisDrawing.ModelSpace.InsertBlock(x, "a1", 1, 1, 1, 0) 'a1 ganti dengan nama blokc
              If a.IsDynamicBlock = True Then
               Props = a.GetDynamicBlockProperties
                   For Index = LBound(Props) To UBound(Props)
                       Set prop = Props(Index)
                           If prop.PropertyName = "Distance1" Then
                                prop.Value = jarak
                           ElseIf prop.PropertyName = "Angle1" Then
                                prop.Value = Sudut
                           End If
                           ThisDrawing.Regen acAllViewports
                   Next Index
                End If
    End Sub
    Attached Files Attached Files

  2. #2
    Login to Give a bone
    0

    Default Re: my block dinamic hatch can not change length and angle

    this is my image please help me what is wrong
    ddd.png

  3. #3
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,396
    Login to Give a bone
    1

    Default Re: my block dinamic hatch can not change length and angle

    Your hatch was not included in the stretch action. I redefined it by modifying the stretch action's selection set and doing a crossing window using points 1,2. After that, the code worked...with modifications. You had 4 variables that were not dimensioned. If you add Option Explicit to the top of each module as shown, the IDE will notify you if you try to use a var that has not been dim'ed. If you set Require Variable Declarations in your VBA options, it will add Option Explicit to new modules.
    Attached Images Attached Images
    C:> ED WORKING....

Similar Threads

  1. Dinamic Block
    By BILLYJOW in forum Dynamic Blocks - Technical
    Replies: 6
    Last Post: 2013-01-30, 04:04 PM
  2. Help - Dinamic block
    By BILLYJOW in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2013-01-22, 12:06 PM
  3. Visibility States - Dinamic Block
    By BILLYJOW in forum Dynamic Blocks - Technical
    Replies: 19
    Last Post: 2012-11-30, 04:13 PM
  4. 2012: DINAMIC BLOCK
    By Scooby in forum Dynamic Blocks - Technical
    Replies: 6
    Last Post: 2012-08-27, 02:26 PM
  5. HELP - DINAMIC BLOCKS
    By BILLYJOW in forum Dynamic Blocks - Technical
    Replies: 2
    Last Post: 2012-08-24, 04:59 PM

Posting Permissions

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