Send Command to autocad

Send Command to autocad

Domziman
Advocate Advocate
279 Views
1 Reply
Message 1 of 2

Send Command to autocad

Domziman
Advocate
Advocate

Hi guys i am trying to Send the MV command to autocad but it doesn't seem to take it can someone help. here is my code.

 

Using trans As Transaction = db.TransactionManager.StartTransaction()
Dim lyTab As LayerTable = trans.GetObject(db.LayerTableId, OpenMode.ForRead)

If lyTab.Has(".VIEWPORT") Then
doc.Editor.WriteMessage(vbLf & "The Layer Has Already Been Created")
trans.Abort()
Else
lyTab.UpgradeOpen()
Dim lyTr As LayerTableRecord = New LayerTableRecord()
lyTr.Name = ".VIEWPORT"
lyTr.Color = Color.FromColorIndex(ColorMethod.ByLayer, 150)
lyTab.Add(lyTr)
trans.AddNewlyCreatedDBObject(lyTr, True)
doc.Editor.WriteMessage("The Layer: .VIEWPORT has been created Successfully")
trans.Commit()
End If

db.Clayer = lyTab(".VIEWPORT")
trans.Commit()
acdoc.SendStringToExecute("._MV");

the MV command it doesnt want to take

Civil 3D Certified Professional
0 Likes
280 Views
1 Reply
Reply (1)
Message 2 of 2

_gile
Consultant
Consultant

Hi,

It seems to me that "MV" is not a command name (perhaps a commande alias).
You should use the full command name and you have to add a space or a carriage return after the command name.

doc.SendStringToExecute("_.MVSETUP ", false, false, true);

or

doc.SendStringToExecute("_.MVSETUP\n", false, false, true);



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes