AutoCAD Command Line Spaces In Filename

AutoCAD Command Line Spaces In Filename

m.arsalan.pti
Observer Observer
427 Views
2 Replies
Message 1 of 3

AutoCAD Command Line Spaces In Filename

m.arsalan.pti
Observer
Observer

I'm creating my own application to programmatically add a block from an external file into the model space. My custom command begins by asking the user to specify the filepath of the block to be inserted.

The problem is that the filepath has spaces in it, therefore AutoCAD command line accepts each space as pressing enter. Is there any way to suppress this issue for entering the filepath?

I'm hoping someone can help me out with the below code.

Thanks in advance. DeepMaterialIt

        <CommandMethod("AddHardware")>
        Public Shared Sub Add_Hardware()
            Dim doc As Document = AutoCADApp.DocumentManager.MdiActiveDocument
            Dim db As Database = doc.Database
            Dim ed As Editor = doc.Editor

            Using tr As Transaction = db.TransactionManager.StartTransaction()

                Dim FileName As String = ed.GetString("Filename").StringResulta

 

0 Likes
428 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant

Assuming that "specify the filepath" means type it in, does it work if you type it in with double-quotes around it?  [I don't know that programming language, so I'm not familiar with its operations or limitations.]

Kent Cooper, AIA
0 Likes
Message 3 of 3

Sea-Haven
Mentor
Mentor

lisp version

 

(command "-insert" "d:\\9 XXX YYYY ZZZZ\\exto" (list 0 0) 1.0 1.0 0.0)
0 Likes