AnsweredAssumed Answered

How to set inverted component labels from net labels?

Question asked by Wolfgang_Antrey on May 28, 2014

Sometime we forget to set the checkbox for annotating the netname to the on/off sheet connectors.

Also there is a problem since the orientation of the text is not taken from the symbol of the on/off sheets connectors. There I wrote the following script ...

 

The only problem is setting the component labels (on/offsheet connectors) correct from the netlabel.

 

eg.

I see a net called ~USB_D this is shown inverted

When I run the script

NetName: "  & objnet.GetLabel(objSeg).ResolvedName  - I get ~USB_D

 

BUT if i set the component label with

set newLabel = objComp.AddLabel( objnet.GetLabel(objSeg).ResolvedName, CoordLabel.X, CoordLabel.Y)

 

I see on the screen only USB_D for the name

 

 

After inserting following code part

 

if left(objnet.GetLabel(objSeg).ResolvedName,1) = "~" then

                        objLabel.Sense = VDINVERTED

end if

 

The name is shown correct - but if I change the component label - the net label changes to ~~USB_D

 

What am I doing wrong?

 

Wolfgang

 

 

CodeSnipet:

 

For each objConnections in objComp.GetConnections

              set objnet = objConnections.Net

              for each objSeg in objnet.GetSegments

 

                if not objnet is nothing then

 

                  if  objComp.Label is nothing then

                    set objLabel = objnet.GetLabel(objSeg)

                    if not objLabel is nothing then

 

                      Set CoordLabel = objnet.GetLabel(objSeg).GetLocation

                      lblOrigin = objnet.GetLabel(objSeg).Origin

                      lblSize = objnet.GetLabel(objSeg).Size

 

                      AppendOutput "DX_Name_Dangler", "WARNING: Net does not have the same name as LINK Symbol: " & objComp.UID & _

                          " (" & objComp.SymbolBlock.GetName(SHORT_NAME) & ") => NetName: "  & objnet.GetLabel(objSeg).ResolvedName & _

                          ", size= " & lblSize  & ", Origin= " & lblOrigin & ", Sense= " & objnet.GetLabel(objSeg).Sense

 

                      set newLabel = objComp.AddLabel( objnet.GetLabel(objSeg).ResolvedName, CoordLabel.X, CoordLabel.Y)

                      set objLabel = objnet.GetLabel(objSeg)

                      objLabel.Origin = lblOrigin

                      objLabel.Size = lblsize

                      if left(objnet.GetLabel(objSeg).ResolvedName,1) = "~" then

 

                        objLabel.Sense = VDINVERTED

                      end if

                    end if

                end if

next

Outcomes