CAD/CAM discussion forum > CAD > how to set monochrome in zwcad using vb.net

how to set monochrome in zwcad using vb.net

Rank: 1

varadh6309

Newbie

posts: 9

Registered: 2012-10-30

Message 1 of 4

 how to set monochrome in zwcad using vb.net
31-10-2012 01:07 . pm | View his/her posts only
how to set monochrome in zwcad using vb.net

dim plot as zwcadplotconfiguration
plot.stylesheet="monochrome.ctb"


but i con't able to load the monochrome settings through vb.net .Kindly help me

Rank: 5Rank: 5

Arphone

posts: 26

Registered: 2012-6-25

Message 2 of 4

02-11-2012 09:53 . am | View his/her posts only
Please refer to following code:

Dim zwcad As Object
Dim actdoc As Object
zwcad = CreateObject("ZwCAD+.Application")
zwcad.Visible = True
actdoc = zwcad.ActiveDocument
Dim styleSheetName As String
actdoc.ActiveLayout.StyleSheet = "monochrome.ctb"
styleSheetName = actdoc.ActiveLayout.StyleSheet
MsgBox("The style sheet for the active layout is: " & styleSheetName)

Rank: 1

varadh6309

Newbie

posts: 9

Registered: 2012-10-30

Message 3 of 4

02-11-2012 10:47 . pm | View his/her posts only
Reply 2# pmf_zwcad


thank u... i ill check it.

Rank: 1

varadh6309

Newbie

posts: 9

Registered: 2012-10-30

Message 4 of 4

14-11-2012 05:01 . pm | View his/her posts only
hai,

thank u for your replay,

herewith i have attached the vb code and also the bmp file for your reference.

kindly give the solution for me.


----------------------------------------------------------------------------------------------------------
Auto cad coding example..



********************** Set the Driver Path in Autocad *************************

Acad2000.Application.Preferences.Files.DriversPath = "\\APPSVR\AutoDraft\CAD_UTILS\DRV1"

********************** Set the Printer Cofiguration path (PC3 Files) *************************



==================================================================================================
Zwcad example coding ....

Public utility As ZwcadUtility 'AcadUtility
Public Acad As ZwcadApplication
Public cad As ZwcadDocument

*******************Connect Zwcad Application*******************


On Error Resume Next
Set Acad = GetObject(, "ZWcad.Application")

If Err.Number = 0 Then
CADOPEN = False
Err.Clear
Set Acad = CreateObject("ZWCAD.Application")

If Err Then
CADOPEN = False
MsgBox Err.Description
Exit Sub
End If
End If
CADOPEN = True
On Error GoTo 0
Acad.Visible = True
Acad.WindowState = zcMax 'acMax
If Acad.Documents.Count = 0 Then Acad.Documents.Add

Set cad = Acad.ActiveDocument
Dim CadViewPort As ZwcadViewport
Set CadViewPort = cad.ActiveViewport
cpath = "Z:\convert\BJ057-09-05-1-002.DWG"
Acad.Documents.Open cpath
Set cad = Acad.ActiveDocument


**********************************PlotToFile*************************


Dim currentPlot As ZwcadPlot
Set currentPlot = Acad.ActiveDocument.Plot
Dim plotconfig As ZwcadPlotConfiguration
Dim plotconfigs As ZwcadPlotConfigurations
Set plotconfig = Acad.ActiveDocument.PlotConfigurations.Add("text")

plotconfig.ConfigName = "ho-sof-002HP LaserJet 1022.pc5"
plotconfig.CanonicalMediaName = "A4"
plotconfig.StyleSheet = "Monochrome.ctb"
plotconfig.StandardScale = zc1_1

Dim point1(0 To 1) As Double
Dim point2(0 To 1) As Double

point1(0) = 0: point1(1) = 0 ': point1(2) = 0
point2(0) = 55019.06: point2(1) = 38860 ': point2(2) = 0

plotconfig.SetWindowToPlot point1, point2


********************Read back window information****************

plotconfig.GetWindowToPlot X1, X2

MsgBox "Press any key to plot the following window:" & vbCrLf & vbCrLf & _
"Lower Left: " & X1(0) & ", " & X1(1) & vbCrLf & _
"Upper Right: " & X2(0) & ", " & X2(1)

*****************Make sure the instruction is to plot a view, not some other plot style*************

plotconfig.CenterPlot = True
plotconfig.StandardScale = zcScaleToFit
Acad.ActiveDocument.Regen zcActiveViewport
Acad.ActiveDocument.SetVariable "BACKGROUNDPLOT", 0
Acad.ActiveDocument.SetVariable "TRAYNOTIFY", 0
plotconfig.PlotType = zcWindow

**********************Example_SetWindowToPlot********************************

cad.ActiveLayout.CopyFrom plotconfig
Acad.ActiveDocument.ActiveLayout.PlotRotation = zc90degrees
cad.Application.ActiveDocument.Plot.DisplayPlotPreview zcFullPreview



====================================================================================================


Acad2000.Application.Preferences.Files.PrinterConfigPath = "\\APPSVR\AutoDraft\CAD_UTILS\PC316-12-08"

********************** Set the Style Sheet Path *************************

Acad2000.Application.Preferences.Files.PrinterStyleSheetPath = "\\APPSVR\AutoDraft\CAD_UTILS\Plotstyle"

----------------------------------------------------------------------------------------------------------
See also