• 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. New Part from XML

Stats

  • State Verified Answer
  • Replies 5
  • Answers 1
  • Subscribers 14
  • Views 551
  • Members are here 0
More Content

New Part from XML

YL202501275314
YL202501275314 26 days ago

This is Reference Code from Cadence Example.

And I would like to add PCB Footprint Information 

How can I Find The information about xml ID ?

puts $lXmlFile {<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<DialogControls>
<Control Type="EDIT" Enable="TRUE" Visible="TRUE" Id="16009">}
puts $lXmlFile "<Value><!\[CDATA\[$lPartName\]\]></Value>"
puts $lXmlFile {</Control>
<Control Type="EDIT" Enable="TRUE" Visible="TRUE" Id="16006">}
puts $lXmlFile "<Value><!\[CDATA\[$lSecLength\]\]></Value>"
puts $lXmlFile {</Control>
<Control Type="EDIT" Enable="TRUE" Visible="TRUE" Id="16012">
<Value><![CDATA[U]]></Value>
</Control>
<Control Type="GROUPBOX" Enable="TRUE" Visible="TRUE" Id="-1">
<Value><![CDATA[Part Numbering]]></Value>
</Control>
<Control Type="AUTORADIO_BUTTON" Enable="TRUE" Visible="TRUE" Id="16002">
<Value><![CDATA[0]]></Value>
<Text><![CDATA[N&umeric]]></Text>
</Control>
<Control Type="AUTORADIO_BUTTON" Enable="TRUE" Visible="TRUE" Id="16003">
<Value><![CDATA[1]]></Value>
<Text><![CDATA[A&lphabetic]]></Text>
</Control>

and I would like to add some Line in symbol

  • Cancel
  • Sign in to reply
Parents
  • TechnoBobby
    0 TechnoBobby 25 days ago

    Hi YL202501275314,

    The code snippet appears to come from the Create Part from Spreadsheet Tcl script. In that, you cannot add or modify part properties. After the parts are created, you must traverse the parts within the .olb  library to update their properties.

    Please refer to the following article and update your script accordingly:
    Title: How can I add/delete one common property to/from all parts present in a library at once?
    URL: https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1Od0000000nYBdEAM&pageName=ArticleContent

    Hope this helps!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • YL202501275314
    0 YL202501275314 25 days ago in reply to TechnoBobby

    Dear TechnoBobby

    I added "add_prop_lib" the end of the TCL  code

    add_prop_lib {$lib_path} {test_item}{test_value}

    but the program has ended to caution.

    and there is no way to change package Footprint

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • TechnoBobby
    +1 TechnoBobby 23 days ago in reply to YL202501275314

    Hi YL202501275314 ,

    Please try the script below. It retrieves the active library currently open in Capture and updates the specified package property on the specified part. Just ensure that no part is opened in edit mode while running the script.

    Hope this helps!

    proc add_pkg_prop {PkgName lProp lValue} {
    set lStatus [DboState]
    set NullObj NULL
    set lCProp [DboTclHelper_sMakeCString $lProp]
    set lCValue [DboTclHelper_sMakeCString $lValue]

    # Get Active library
    set lSrcLib [GetActivePMLastLibrary]
    if {$lSrcLib == $NullObj} {
    puts "ERROR: No Active library"
    return
    }

    # Iterate packages
    set lPkgIter [$lSrcLib NewPackagesIter $lStatus]
    set lPackage [$lPkgIter NextPackage $lStatus]
    while {$lPackage != $NullObj} {
    # Package name
    set pkgCStr [DboTclHelper_sMakeCString]
    $lPackage GetName $pkgCStr
    set Pkg_Name [DboTclHelper_sGetConstCharPtr $pkgCStr]

    if {$Pkg_Name== $PkgName} {
    $lPackage SetEffectivePropStringValue $lCProp $lCValue
    puts "Property: $lProp updated on Part: $Pkg_Name"
    }

    # puts $lPackage
    set lPackage [$lPkgIter NextPackage $lStatus]
    }
    delete_DboLibPackagesIter $lPkgIter
    }

    # Example usage:
    add_pkg_prop "Part1" "PCB Footprint" "smdcap"

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Reply
  • TechnoBobby
    +1 TechnoBobby 23 days ago in reply to YL202501275314

    Hi YL202501275314 ,

    Please try the script below. It retrieves the active library currently open in Capture and updates the specified package property on the specified part. Just ensure that no part is opened in edit mode while running the script.

    Hope this helps!

    proc add_pkg_prop {PkgName lProp lValue} {
    set lStatus [DboState]
    set NullObj NULL
    set lCProp [DboTclHelper_sMakeCString $lProp]
    set lCValue [DboTclHelper_sMakeCString $lValue]

    # Get Active library
    set lSrcLib [GetActivePMLastLibrary]
    if {$lSrcLib == $NullObj} {
    puts "ERROR: No Active library"
    return
    }

    # Iterate packages
    set lPkgIter [$lSrcLib NewPackagesIter $lStatus]
    set lPackage [$lPkgIter NextPackage $lStatus]
    while {$lPackage != $NullObj} {
    # Package name
    set pkgCStr [DboTclHelper_sMakeCString]
    $lPackage GetName $pkgCStr
    set Pkg_Name [DboTclHelper_sGetConstCharPtr $pkgCStr]

    if {$Pkg_Name== $PkgName} {
    $lPackage SetEffectivePropStringValue $lCProp $lCValue
    puts "Property: $lProp updated on Part: $Pkg_Name"
    }

    # puts $lPackage
    set lPackage [$lPkgIter NextPackage $lStatus]
    }
    delete_DboLibPackagesIter $lPkgIter
    }

    # Example usage:
    add_pkg_prop "Part1" "PCB Footprint" "smdcap"

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Children
  • YL202501275314
    0 YL202501275314 21 days ago in reply to TechnoBobby

    Dear Bobby 

    It's working well,

    And I would like to change Part Reference Prefix

    i tried 

    add_pkg_prop "Part1" "Part Reference Prefix" "T"

    But it's not working 

    Would you help it again 

    Thank you

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • YL202501275314
    0 YL202501275314 21 days ago in reply to YL202501275314

    And I would like to add geometry

    in Symbol

    Would like to placeline x1 y1 x2 y2 like this 

    but its not working in TCL code

    Would you give me a guide ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify 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.

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

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