GetDynamicBlockProperties Null object ID error for profile <<ACADMPP>>

GetDynamicBlockProperties Null object ID error for profile <<ACADMPP>>

jeremye86
Advocate Advocate
1,600 Views
8 Replies
Message 1 of 9

GetDynamicBlockProperties Null object ID error for profile <<ACADMPP>>

jeremye86
Advocate
Advocate

Im filling dynamic block attributes with GetDynamicBlockProperties but Im getting Null object ID error  for profile <<ACADMPP>> .  Everything works fine under the profile <<VANILLA>>.  Please help as some users like to use different profiles.

0 Likes
1,601 Views
8 Replies
Replies (8)
Message 2 of 9

Ed__Jobe
Mentor
Mentor

Different profiles can load different libraries. Apparently something is missing from <<ACADMPP>> that <<VANILLA>> has. You don't provide much other info to troubleshoot with, like maybe the line that errors or what object is missing.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 9

jeremye86
Advocate
Advocate
Sub test()
    Dim objBlockRef As AcadBlockReference
    Dim BlkAtts As Variant
    Dim PntPerimSht(0 To 2) As Double
    Dim i As Long


    Set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(PntPerimSht, "perimShtDyn", 1, 1, 1, 0)
    BlkAtts = objBlockRef.GetDynamicBlockProperties
                
               
    On Error Resume Next
    For i = 0 To UBound(BlkAtts)
        Debug.Print BlkAtts(i).Value & "   " & i
    Next i
    On Error GoTo 0
                
                
    BlkAtts(0).Value = 293#   'i am getting error here for  <<ACADMPP>> profile
    BlkAtts(2).Value = 7#
    BlkAtts(4).Value = 7#
    BlkAtts(6).Value = 45#
    BlkAtts(8).Value = 16.2

    BlkAtts(14).Value = 7#
    BlkAtts = objBlockRef.GetAttributes
    BlkAtts(0).TextString = "CP" & 1 & "A"

End Sub
0 Likes
Message 4 of 9

jeremye86
Advocate
Advocate

i attached the code and the block im using above

0 Likes
Message 5 of 9

Ed__Jobe
Mentor
Mentor

I was unable to duplicate the error. When you are in the <<ACADMPP>> profile, go to Tools>References in the vbaide and see if there are any references that say MISSSING in front of them.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 6 of 9

jeremye86
Advocate
Advocate

i didn't see anything missing in the library.

 

when the shortcut target is this i get an error

"C:\Program Files\Autodesk\AutoCAD 2017\acad.exe"  /p <<ACADMPP>> /product ACADM /language "en-US"

 

when the shortcut target is this i dont get an error

"C:\Program Files\Autodesk\AutoCAD 2017\acad.exe" /p <<VANILLA>> /product ACADM /language "en-US"

0 Likes
Message 7 of 9

Ed__Jobe
Mentor
Mentor

Try modifying your code like below and step through the execution. See if you get a different error and what line is it on. Do you know how to set a breakpoint and step through code execution?

 

               
    'On Error Resume Next
    For i = 0 To UBound(BlkAtts) Step 2
        Debug.Print BlkAtts(i).Value & "   " & i
    Next
    'On Error GoTo 0

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 8 of 9

jeremye86
Advocate
Advocate

Ed thanks for your responses, i figured it out.

If i use 

 ThisDrawing.Regen acActiveViewport

or 

Application.Update

 

after this line Set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(PntPerimSht, "perimShtDyn", 1, 1, 1, 0)

then the code works.

 

I sill confused though.  Do you know why i would need this for for certain profiles but not for others?

0 Likes
Message 9 of 9

Ed__Jobe
Mentor
Mentor

I'm not sure, as I don't know where the error is coming from yet.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes