Jump to content

ObjectID returns error 64bit autocad


jurgen wuytack

Recommended Posts

we are using Autocad2009. My processor is tyhe only 64-bit and has a probem in vba when we use the objectID.

can anyone help me with this problem. I've searched the wole internet and it seems to be somethinh with the 64-bit processor which returns an longer value then the 32-bit ?

Link to comment
Share on other sites

I have no way to test this method with 64bit, but it is worth a try. The attached sample just changes the color of an object by manipulating a reference returned via ObjectId.

 

Sub objIDTest()
Dim ent As AcadEntity
Dim varPkPt As Variant
Dim entTransfer As AcadEntity
Dim strObjId As String
  With ThisDrawing
     .Utility.GetEntity ent, varPkPt, "Select and entity:"
     strObjId = ThisDrawing.Utility.GetObjectIdString(ent, False)
     Set entTransfer = .ObjectIdToObject(CLng(.Utility.DistanceToReal(strObjId, acDecimal)))
     entTransfer.color = acRed
  End With
End Sub

Link to comment
Share on other sites

If ThisDrawing.PaperSpace.Item(T1).ObjectName = "AcDbBlockReference" Then

Set Kader = ThisDrawing.PaperSpace.Item(T1)

BlokNaam = UCase(Kader.Name)

If BlokNaam = "A3ELEK" Then

kaderID(0, volgnr) = Kader.ObjectID (deze code geeft error)

kaderID(1, volgnr) = Blad

VarAttributes = Kader.GetAttributes

kaderID(2, volgnr) = VarAttributes(1).TextString

kaderID(3, volgnr) = VarAttributes(2).TextString

volgnr = volgnr + 1

blnr = Val(Blad)

If blnr > max Then max = blnr

End If

End If

Link to comment
Share on other sites

Unfortunately, your situation is outside my ability to help. I don’t have a 64bit version of AutoCAD to test any code, nor the ability to fully comprehend code snippets written in the Dutch language.

 

It looks like you are storing an ObjectID in some form of database. The basis of my code sample was that you may be able to store the ObjectID as a string instead of a Long data type. The tricky part (the part I can not test) is the ability for both 32bit and 64bit to use that string to return an object.

Link to comment
Share on other sites

Seant

I've changed nog the objectid to objectid32 (only available in 64-bit version)

with the code objectidtoobject32 it seems to work. The only difference we know see, is that the routine is much slower (takes about 20 sec to run) then on the 32-bit version (routine is done in 0.5 sec)

Thanks for your efforts

Link to comment
Share on other sites

I suspect you will see all VBA routines running slower on 64bit due to the ‘out of process’ setup used by AutoCAD 64 bit.

 

It is good to see you have at least some level of performance available.

 

One thing to check (why I was leaning towards a method of identification based on ‘string’s) is backward compatibility i.e., coping with values generated with the 64bit version back on the 32bit machines.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...