[S8374] Script for specifying part colors and grouping parts

 

The following is an example of a script that specifies part colors and performs grouping.

app = designer.GetApplication()

# Select parts by coordinates and change their colors

app.GetModel(0).GetPartByPosition(app.CreatePoint(35,5,0)).SetColor(u"blue")

# Select parts by coordinates and rename them

app.GetModel(0).GetPartByPosition(app.CreatePoint(35,5,0)).SetName(u"Coil1")

# Create a group

app.GetModel(0).GetGroupList().CreateGroup(u"Coil")

# Add parts to the group

app.GetModel(0).GetGroupList().AddPartToGroup(u"Coil", u"Coil1")

app.GetModel(0).GetGroupList().AddPartToGroup(u"Coil", u"Coil2")

app.GetModel(0).GetGroupList().AddPartToGroup(u"Coil", u"Coil3")

How to use script file

Use the JMAG Script Library after reading and agreeing to the following terms of use.