AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

supressing wire numbers

3 REPLIES 3
Reply
Message 1 of 4
testsubject
343 Views, 3 Replies

supressing wire numbers

Hi all,

 

I am trying to change the wire layer format automatically (specifically turning OFF wire numbering) for several drawings I have. I am aware of the "Create/Edit Wire Type" but want to automate it using maybe a script. I did do a search but came up empty. Anyone try this yet??

 

Thanks,

 

Robert Hanrahan



Bob Hanrahan
Ace User since 1998
If this answered your question, please click on "Accept Solution"
3 REPLIES 3
Message 2 of 4
rhesusminus
in reply to: testsubject

You'll have to create a program to achieve this. My investigation found that this setting resides in an xrecord in the actual layer.

 

So.. lisp/vba/.net... Go on 🙂

 

THL


Trond Hasse Lie
AutoCAD Electrical and EPLAN expert
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 3 of 4
rhesusminus
in reply to: rhesusminus

Since I was already on it.. here's some VBA code to set the Wire Numbering On/Off...

 

 

Option Explicit

Public Sub Test()

    Call SetLayerWireNumbering("WIRES", True)
    
End Sub

Public Sub SetLayerWireNumbering(ByVal LayerName As String, ByVal WireNumbering As Boolean)
    
    Dim Layer As AcadLayer
    Dim Dic As AcadDictionary
    Dim XRecord As AcadXRecord
    Dim XRTypes As Variant
    Dim XRValues As Variant
    
    ' Step through all layers
    For Each Layer In ThisDrawing.Layers
        
        ' If layer name matches the Layer to be changed...
        If StrComp(Layer.Name, LayerName, vbTextCompare) = 0 Then
            
            ' If layer has dictionary...
            If Layer.HasExtensionDictionary Then
                
                ' Get dictionary
                Set Dic = Layer.GetExtensionDictionary
                
                ' Get first XRecord in dictionary
                Set XRecord = Dic.Item(0)
                
                ' Get XRecord data
                Call XRecord.GetXRecordData(XRTypes, XRValues)
                
                ' Set "bit" for Wire Numbering
                If WireNumbering Then
                    XRValues(24) = 1
                Else
                    XRValues(24) = 0
                End If
                
                ' Write XRecord data
                Call XRecord.SetXRecordData(XRTypes, XRValues)
                
                ' Exit the layer loop
                Exit For
                
            End If ' If layer has extension dictionary...
        
        End If ' If layer name matches the Layer to be changed...
    
    Next ' Step through all layers
    
End Sub

 

 

 

 

Copy/Paste this into the THisDrawing module in the VBA editor, and experiment with the Test-subroutine.

This could also be implemented in a script if needed.

 

THL


Trond Hasse Lie
AutoCAD Electrical and EPLAN expert
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 4 of 4
testsubject
in reply to: rhesusminus

Thanks for the response! I will give this a try and let you know how it worked out.

 

Bob



Bob Hanrahan
Ace User since 1998
If this answered your question, please click on "Accept Solution"

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost