PTC Modeler Script
This is a sample script that uses a PTC Modeler diagram to automatically layout nested classes.
#-------------------- # Diagram Formatting: # Recursively Populate Nested Classes #-------------------- Set oSymbol=Projects.Item("Active Symbol") Set oTopReqt = oSymbol.Item("Dict Item") Position = oSymbol("Position") Pos=Split(Position,",") X=CLng(Pos(0)) Y=CLng(Pos(1)) Try oSymbol, oTopReqt, X, Y Sub Try(oSymbol,oReq, X, Y) X=X+500 Set oSubReqs = oReq.Items("Contained Class") For Each oSubReq In oSubReqs Y=Y+350 ActiveProject("Transaction")="Begin" Set oSubSymbol = oSymbol.Item("Diagram").Add("CD Class") oSubReq.Add "CD Class",oSubSymbol Studio.DisplayOutputWindowMessage CStr(X)&","&CStr(Y)+vbNewline oSubSymbol("Position")=CStr(X)&","&CStr(Y) Set oLine = oSymbol.Item("Diagram").Add("CD Contained Class Link") oSubSymbol("Width")="900" oSubSymbol("Height")="300" oLine.Add "Contained Class Symbol",oSubSymbol oLine.Add "Containing Class Symbol",oSymbol oLine("Waypoints")=CStr(X-250)+","+CStr(Y+100) ActiveProject("Transaction")="Commit" Try oSubSymbol,oSubReq,X,Y Next X=X-500 End Sub