• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X Scripting - TCL
  3. TCL flat net export / import

Stats

  • State Suggested Answer
  • Replies 1
  • Answers 1
  • Subscribers 12
  • Views 1674
  • Members are here 0
More Content

TCL flat net export / import

ggeorgg
ggeorgg over 1 year ago

Hi!

I am using following (similar) code to set the net color of all flat nets in my design depending on the flat net property "NET_SPACING_TYPE". I use this code to easily visualize flat nets which have a wrong value in this property.


set DboDesign [GetActivePMDesign]
set lStatus [DboState]

set CStringPropertyName [DboTclHelper_sMakeCString "Color"]
set CStringPropertyValue [DboTclHelper_sMakeCString "RGB(255,  0,  0)"]

set CStringPropertyName2 [DboTclHelper_sMakeCString "NET_SPACING_TYPE"]
set CStringPropertyValue2 [DboTclHelper_sMakeCString]

set lFlatNetsIter [$DboDesign NewFlatNetsIter $lStatus]

#get the first flat net of design
set lFlatNet [$lFlatNetsIter NextFlatNet $lStatus]
while { $lFlatNet != "NULL" } {
    puts "set lFlatNet $lFlatNet"

    $lFlatNet GetEffectivePropStringValue $CStringPropertyName2 $CStringPropertyValue2
    set EffectivePropertyValue [DboTclHelper_sGetConstCharPtr $CStringPropertyValue2]

    if { $EffectivePropertyValue eq "High_Power"} {
        # Color/Highlight the flat net
        $lFlatNet SetEffectivePropStringValue $CStringPropertyName $CStringPropertyValue
    }

    #get the next flat net of design
    set lFlatNet [$lFlatNetsIter NextFlatNet $lStatus]
}
delete_DboDesignFlatNetsIter $lFlatNetsIter
$lStatus -delete
Menu "View::Zoom::Redraw"

Sometimes it is working, sometimes not.
One thing I found out is, that it is normally working, if the flat nets color has been edited manually in the schematic at least once before executing this code. 
Another thing I observed is, that in hierarchical designs it normally does not color the flat nets which are located on the root page, even though I know for sure the SetEffectivePropStringValue command gets execute for those flat nets as well.
I also observed, that I have to call "View::Zoom:Redraw" to directly see the changes (if it works at all).
I know the "Tools-Export Properties" menu. The flatnet colors get exported, but when changing the net color in the design and then importing the flatnets again, the color is not set back again. Why?
Does anyone have some hints why this code is not always working?
Best regards
Georg
  • Cancel
  • Sign in to reply
  • CadAP
    0 CadAP over 1 year ago

    Hi Georg,

    I am not sure but you may try display the flat net on deign then you try your code for changing the color.

    Below code for displaying the faltnet.

    proc GetFlatNet {InstOcc wireobj } {

    set CStringPropertyName [DboTclHelper_sMakeCString "Color"]
    set CStringPropertyValue [DboTclHelper_sMakeCString "RGB(255, 0, 0)"]
    #set InstOcc [GetInstanceOccurrence]

    set designobj [$InstOcc GetOwner]

    set state [DboState]

    set netobj [$wireobj GetNet $state]

    set lNetName [DboTclHelper_sMakeCString]

    $netobj GetNetName $lNetName

    #puts "Net Name:[DboTclHelper_sGetConstCharPtr $lNetName]"

    set schNet [$netobj GetSchematicNet]

    $schNet GetName $lNetName

    #puts "Schematic Net Name:[DboTclHelper_sGetConstCharPtr $lNetName]"

    set netocc [$schNet GetOccurrenceFromParent $InstOcc]

    set netoccObj [DboOccurrenceToDboNetOccurrence $netocc]

    set flatnetobj [$netoccObj GetFlatNet $state]

    set stringobj [DboTclHelper_sMakeCString]

    $flatnetobj GetName $stringobj

    #puts "Flat Net Name:[DboTclHelper_sGetConstCharPtr $stringobj]"
    $flatnetobj SetEffectivePropStringValue $CStringPropertyName $CStringPropertyValue

    return [DboTclHelper_sGetConstCharPtr $stringobj];

    }

    proc enabler {args} {

    return true;

    }

    proc GetCustomNetAliasDisplayName {pAlias pSchOcc pName} {

    set wire [$pAlias GetOwner]
    set pPage [$wire GetOwner]

    #puts $wire

    if {$pSchOcc == "NULL"} {

    return $pName

    }

    return [GetFlatNet $pSchOcc $wire]
    DboTclHelper_sEvalPage $pPage

    }

    RegisterAction _cdnGetCustomNetAliasDisplayName enabler "" GetCustomNetAliasDisplayName "";

    Hope this helps!

    Thanks.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information