[CONNECT VBA] Sendkeyin

This part of code crashes CE. Is it only for me?

Sub place_text()
CadInputQueue.SendCommand "place text"
            CadInputQueue.sendkeyin "sometext"
End Sub

 

Parents
  • Strange that key-in: "place text;sometext" crashed also but after I placed text with normal dialog it worked afterwards. We have textstyles that are attached from dgnlib so it may be related to fact that no textstyle was active.

    I hope place text key-in will not removed as this is useful for placing automatic texts from simple interface tools.
  • It is an issue regressed in U2 and is in U3. We had found it earlier but fix failed to make it in U3 for valid reasons. As I mentioned above, this has been fixed in WIP builds of U4.

    As a work around for now, you can use text editor or can record text placement script using text editor.

    CadInputQueue.SendKeyin "TEXTEDITOR PLACE"
    CadInputQueue.SendKeyin "TEXTEDITOR PLAYCOMMAND INSERT_TEXT ""something"""

    Or you can use VBA object model as RoadWing and Robert mentioned.

    In our reply, we haven't mentioned anything on removal / replacement. Please take a note on this.



  • Another issue with CreateTextElement1 that I need to multiply origin with units resolution otherwise it is not correct. But same origin works for cell elements without issue. Is it by design?

    Set oText = CreateTextElement1(Nothing, " Text", Point3dZero, Matrix3dIdentity)
    
    pt.x = p.x * UORs
    pt.y = p.y * UORs
    
             oText.Origin = pt
            
    
    ActiveModelReference.AddElement oText
Reply Children