Hello
For the strong in MYCAD integration how to reactivate a printer for one of the layers
I did the activate function of the format layer
I had activated *
but nothing works
To show hide a layer:
On the other hand, to print or not to print no function visibly.
The problem is that I have already realized this
it displays the eye but not the printer => in PDF format so no line appears since it is not printed.
in the image in PJ it's format that doesn't print
I think that " poster " is + to show the tracing paper but not the print
Yes that's what I was telling you to show hide it's possible but no option for printing or no printing.
On the other hand you can launch a macro via integration:
You start by creating your macro:
Macro tool, new you name it what you want.
Then you paste this code in:
Option Explicit
'Changer ci-dessous le nom du calque à rendre invisible à la place de NomDuCalque
Public Const layerName As String = "NomDuCalque"
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swLayerMgr As SldWorks.LayerMgr
Dim swLayer As SldWorks.Layer
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swLayerMgr = swModel.GetLayerManager
Set swLayer = swLayerMgr.GetLayer(layerName)
swLayer.Printable = False 'Pour rendre le calque visible mettre True
End Sub
Be careful to run only on MEPs that have the layer created otherwise there will surely be an error, since I have not integrated error handling into the code.
hum I didn't remember the macro launcher ...
If we place a layer condition in Integration it can help not to have error handling
Yes but at this point, you might as well put it in the macro:
Option Explicit
'Changer ci-dessous le nom du calque à rendre invisible à la place de NomDuCalque
Public Const layerName As String = "NomDuCalque"
Sub main2()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swLayerMgr As SldWorks.LayerMgr
Dim vLayerArr As Variant
Dim vLayer As Variant
Dim swLayer As SldWorks.Layer
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
'Vérification si un modèle est chargé
If swModel Is Nothing Then
Exit Sub
End If
'Vérification si le document chargé est une MEP
If (swModel.GetType <> swDocDRAWING) Then
Exit Sub
End If
Set swLayerMgr = swModel.GetLayerManager
vLayerArr = swLayerMgr.GetLayerList
For Each vLayer In vLayerArr
Set swLayer = swLayerMgr.GetLayer(vLayer)
'Vérification du nom du calque
If swLayer.Name = layerName Then
swvLayer.Printable = False 'Pour rendre le calque visible mettre True
End If
Next
End Sub