←  Technical Questions

nanoCAD forum

»

VB nanoCAD.Document.SendCommand("-laye...

Pape's Photo Pape 20 Jun 2016

[THIS IS SOLVED]

Hi users of NanoCAD Forum,

i use NanoCAD 5.0 and try to start a macro to turn layers off or on.
I try the nanoCAD.Document.SendCommand() in VB.

Imports nanoCAD
Dim napp As nanoCAD.Application
Dim ndoc As nanoCAD.Document
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
napp = New nanoCAD.Application 'nanocad have to be open with document'
ndoc = napp.ActiveDocument
'all Layer off'
ndoc.SendCommand("-layer;_off;*;;")'DOESN T WORK'
ndoc.SendCommand("-layer" & Chr(13) & "OFF" & Chr(13) & "*" & Chr(13) & "NO" & Chr(13) & Chr(13))'DOESN T WORK'
End Sub

What i am doing wrong?

I got a solution!

This is now working for me.
ndoc.SendCommand("-LAYER" & vbCr & "OFF" & vbCr & "*" & vbCr & "YES" & vbCr & vbCr)

Thanks the examples from other members.
greeting from Germany
Edited by Pape, 23 August 2016 - 05:29 AM.
Quote