8 Replies Latest reply on Jan 13, 2010 5:54 PM by john_dube

    How to change/remove component/net name on dxdesigner

    sunchaos

      Hi All,

       

      I saw dxdesigner automation document and found how to get name of component/net.

      But, I cannot find how to change/remove component/net name.

       

      Please, help me!

        • 1. Re: How to change/remove component/net name on dxdesigner
          Satoru

          Hi sunchaos-san,

           

          Deletion of a component or a net uses a DeleteSelected method.

          Example:

              Call dxdView.Block.DeleteSelected(True)

           

          A change of a net name acquires and changes a label object.

          Example:

              For Each nt In dxdView.Query(VDM_NET, VD_SELECTED)
                  Set seg = nt.GetSegments.Item(1)
                  Set lab = nt.GetConnectedLabel(seg)
                  If Not lab Is Nothing Then
                      lab.TextString = "XXXX"
                  Else
                      pX = (seg.Location(VDJ_HIGH).X - seg.Location(VDJ_LOW).X) / 2 + seg.Location(VDJ_LOW).X
                      pY = (seg.Location(VDJ_HIGH).Y - seg.Location(VDJ_LOW).Y) / 2 + seg.Location(VDJ_LOW).Y
                      Call nt.AddLabel(seg, "XXXX", pX, pY)
                  End If
              Next

           

          A change of a component is placed after deleting.

          Placement uses an AddSymbolInstance method.

           

          Regards,

          Satoru

          • 2. Re: How to change/remove component/net name on dxdesigner
            sunchaos

            Hi Satoru-san,

             

            Thank for your reply.

             

            I apply your sample code to my script. My code is below. but, I can find message "Error 1099: Label is invalid."

            Please, help me. How to resolve my problem.

            -----------------------------------------------------------------------------------------------------------------------------------------

            Option Explicit

             

            Dim vdapp,vddoc,vdview

             

            Set vdapp = Application

            Set vddoc = vdapp.ActiveDocument

            Set vdview = vdapp.ActiveView

             

            Dim blk, s_DesignName, s_DesignAlias, s_ProjectData

            Set blk = ActiveView.ActiveBlock

            Set s_ProjectData = vdapp.GetProjectData()

            s_DesignName = blk.GetName(SHORT_NAME)

            s_DesignAlias = blk.LibraryName

             

            Dim objComps

            Set objComps = DesignComponents(s_DesignAlias, s_DesignName, -1, "STD", False)

             

            Dim objComp, objSymBlk, objCompName, objSymBlkName, objCompAttr, sAttrVal, iSymType

             

            Dim compCount : compCount = 0

            Dim compNetArray()

            Dim i, j

            For Each objComp In objComps

            Set objSymBlk = objComp.SymbolBlock

            iSymType = objSymBlk.SymbolType

                  If (iSymType = VDB_ANNOTATE) Then

                      objCompName = objComp.GetName(1)

                      If Instr(objCompName, "$") = 0 Then

                        If Not objComp.Label Is Nothing Then

                          objComp.Label.TextString = ""

                        End If

                      End If

                  End If

            Next

            -----------------------------------------------------------------------------------------------------------------------------------------

             

            • 3. Re: How to change/remove component/net name on dxdesigner
              john_dube

              Hi Sunchaos,

               

              As Satoru-san suggested, use DeleteSelected to remove a label.

               

              You can refer to Removing system-defined names from a translated schematic for a complete example.

               

              John

              • 4. Re: How to change/remove component/net name on dxdesigner
                sunchaos

                I'm really thank you for your help. Happy New Year!

                Thanks satoru san, john.

                • 5. Re: How to change/remove component/net name on dxdesigner
                  Alpha

                  Hello,

                  i trying to set  the color of the NET LABEL to automatic doing this :

                   

                  Dim  vdapp
                      
                         Set vdapp = GetObject(, "ViewDraw.Application")
                         vdapp.Visible = True 

                  For Each objComp In vdapp.Query(VDM_NET, VD_ALL)
                          Set seg = objComp.GetSegments.Item(1)
                          Set lab = objComp.GetConnectedLabel(seg)
                          lab.SetAutomaticColor(True)
                    Next

                   

                  Problem is i'am becoming an error telling that lab

                  is an unknown object !!!!!

                   

                  Normaly lab in this case is an object of type Label.

                  That's why i'am writting :   lab.SetAutomaticColor(True)

                  What am i doing wrong ??

                  how can i set the color of a Net's label to automatic ?

                   

                  Happy new year 2010, to all of you.

                   

                  Bye.

                  • 6. Re: How to change/remove component/net name on dxdesigner
                    john_dube

                    Not all nets have a label, your script assumes that every net has a label on the first segment.

                     

                    Try this instead:

                     

                    For Each objNet In vdapp.Query(VDM_NET, VD_ALL)

                         For Each objSeg in objNet.GetSegments
                            Set lab = objNet.GetLabel(objSeg)

                            If Not lab Is Nothing Then
                                 lab.SetAutomaticColor(True)

                            End If

                         Next
                      Next

                     

                    Alternatively, you might try using keyin commands, like "slabel *" and "color white" to change the color of every label.  I'm not sure if the color command can reference the default object color.

                     

                    John

                    • 7. Re: How to change/remove component/net name on dxdesigner
                      Alpha

                      Hello John,
                      thank you for your helpfull post.
                      Actually i am trying to set the color of the pin number text to automatic too,
                      but i am not so familiar with this !!

                       

                      Here is what i am doing

                       

                      '------------------------------------------------------------------------------------------

                        Dim  vdapp,vdview,vddoc,objComp

                         Set vdapp = GetObject(, "ViewDraw.Application")
                         vdapp.Visible = True
                         Set vdview = vdapp.ActiveView
                         Set vddoc = vdapp.ActiveDocument
                        
                         Desgin_Name = vdapp.GetActiveDesign  
                         vdapp.Visible = True


                      For Each objComp in vdapp.ActiveView.Query(VDM_COMP, VD_ALL)
                      For Each objConn in objComp.GetConnections
                        Set objPin = objConn.CompPin.Pin


                          objPin_label=objPin.Label.TextString ' Name of the Pin
                          Msgbox"Label_ = " &objPin_label
                          
                       
                          ' I have been trying to get the Pin number like this:
                          Set objAttr = objPin.FindAttribute("#")
                             If Not objAttr Is Nothing Then
                           MsgBox "value" &objAttr.Value
                          End If
                          'This is unfortunatly not working
                          'I am using dxdesigner in expedition flow, should i used # in this flow to find out the
                          'pin number info ?
                       
                       
                        ' I can get acollection of pin's attributes like this , but this is not helping me !!
                             For Each Attr In objPin.Attributes
                                MsgBox " Pin Attribute: " &Attr.Value
                              Next   
                      Next 
                      Next

                       

                      'How can i access the Label Object of the pin number ??

                      'I want to set  the color of the pin number text to automatic.

                       

                      'Thank you for the support.

                      • 8. Re: How to change/remove component/net name on dxdesigner
                        john_dube

                        Hi Alpha,

                         

                        Look for the pin number ("#") attribute on the component pin, not the symbol pin:

                         

                        For Each objComp in vdapp.ActiveView.Query(VDM_COMP, VD_ALL)

                             For Each objConn in objComp.GetConnections

                                  Set objPin = objConn.CompPin

                                  MsgBox "Label_=" & objPin.Pin.Label.TextString

                                  Set objAttr = objPin.FindAttribute("#")

                                  If Not objAttr Is Nothing Then

                                       objAttr.SetAutomaticColor True

                                  End If

                             Next

                        Next

                         

                        If you are using the integrated flow, use FindAttribute("Pin Number") instead of FindAttribute("#") which is appropriate for the netlist flow.

                         

                        John