jurgen wuytack Posted February 23, 2009 Posted February 23, 2009 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 ? Quote
ReMark Posted February 23, 2009 Posted February 23, 2009 Could you post the exact wording of the error message you're receiving? Thank you. Quote
SEANT Posted February 23, 2009 Posted February 23, 2009 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 Quote
jurgen wuytack Posted February 25, 2009 Author Posted February 25, 2009 Compile error Function or interface markes as restricted or the function uses an automation type not supported in Visual Basic Quote
SEANT Posted February 25, 2009 Posted February 25, 2009 Which line of code generated the error, and in which version of AutoCad (64 and/or 32 bit)? Quote
jurgen wuytack Posted February 25, 2009 Author Posted February 25, 2009 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 Quote
SEANT Posted February 25, 2009 Posted February 25, 2009 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. Quote
jurgen wuytack Posted February 25, 2009 Author Posted February 25, 2009 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 Quote
SEANT Posted February 25, 2009 Posted February 25, 2009 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. Quote
Recommended Posts
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.