I'm migrating some VBA code to AutoCAD 2012, but after inserting a block, a strange thing is happening:
AutoCAD sees the period char in a String as a strange 'Square"-char
for example: "MyAutoCAD.dwg" is becoming "MyAutoCAD dwg", where the space between the filename and the extension is showing a square.
Anyone did have the same problem of any tip ?
the "strange 'Square'-char" often appears if you mix Unicode and ASCII-Code. And if you try to evaluate 16bit-character with a 8bit textfunction then you can get such problems.
So the next step: where do you get the character-sequence from, in what type of variable do you store it and .... so in short words: show the code-snippets where you read, evaluate and output the text.
- alfred -
thanks for the reply:
m_KaderNaam = UCase("staxn002e.dwg")
Set m_objBlockRef = ThisDrawing.PaperSpace.InsertBlock(m_ptBlockIns(), m_KaderNaam, 1, 1, 1, 0)
In the above code the name is set by the var (as type string) m_KaderName which represents the name of a block to insert
the insert proces is going fine, but strangely enough
after the insert proces the string is 'corrupted', in other words the period is replaced by a square-char (or another machines another char) -> See: PrintScreen of the Debug-mode
well I tried this code:
Public Sub test() Dim tBlName As String Dim tPnt(2) As Double Dim tBlRef As AcadBlockReference tBlName = "C:\TEMP\X.DWG" Set tBlRef = ThisDrawing.ModelSpace.InsertBlock(tPnt, tBlName, 1, 1, 1, 0) MsgBox tBlName End Sub
...and when I look to the result of the messagebox or the tooltip during breakpoint I can not reproduce what you get.
So try my test-sub and verify if that happens also with this code. If so, let us know operating-system and language.
My feeling is (sorry for that): this line of your code:
m_Ret = SMD_LOGFILE_WRITE(m_LogFile, " " & m_KaderNaam)
does some conversion to your variable, I don't beleive the ".INSERT"-function does any modification to the string.
HTH, - alfred -
try a new AutoCAD-session, don't load any of your DVB-projects and - within a new DVB-project - try my code .... same problem?
Sorry that I cannot test with AutoCAD 2012 on an XP-machine, I have currently Win7x64 for testing.
>> How to you manage to integrate your PrintScreen without Attachment ?
Copy & Paste
So you can directly paste an image into your answer-text (like you do it in MS-Word). Of course it seems to be limited by any regulation, sometimes I get the info that my answer is blocked as it exceeds 50000char (when I inserted an image). I do then reduce it's size or the color-depth to 8 bit.
- alfred -
Very strange, Alfred
I'm afraid I'll have to program a Workaround by copying the value in another var and cosuming this var.
Thanks anyway for your help
I keep you informed if a solution is found
Start with some of our most frequented solutions to get help installing your software.