11 Replies Latest reply on Jan 23, 2013 7:06 AM by avjohn

    How can I change the sheet number in a script?


      In DxDesigner, in the Project Navigator window, it's possible to change the "sheet number" to describe the circuitry on the sheet.


      We know that in a scripot you can access the sheet number by the Block.SheetNum proprerty.  This is a read-only property however.


      Is there a way in a vbscript to change the sheet number?





        • 1. Re: How can I change the sheet number in a script?

          I'm not 100% sure, but I think you'd have to define your own property, and make it visible instead of the one that is there by default.

          • 2. Re: How can I change the sheet number in a script?

            While that would work for components and nets, I don't think it'll work for the sheet names and numbers.



            • 3. Re: How can I change the sheet number in a script?

              Sure it will.  That's how we currently do hierarchical designs.  We added a property called "page_num" to the borders, and use scout to renumber it.  This is also how the new page numbering system in 7.9.3 and higher works. (different property name, and I can't find the instructions to use it right now)  They added a new property that the system sets.  They just didn't get all the steps automated yet.





              for the old way.



              Here is a newer way, but we haven't had time to implement yet:



              That second link has a full page numbering system!!!!



              Remember, Borders are just symbols that don't resolve during packaging.  You can add any non-system property to them, and then change that all you want.  (and turn off or remove the system ones if you want)




              Wish I could find the link to the new page numbering system, but need to get back to work.


              • 4. Re: How can I change the sheet number in a script?

                You can also change the sheet number and add text like the picture below.  Our Engineers like this feature because it helps them keep track of what circuit is on each sheet.



                I'm looking for a way to rename the sheet number using a VBscript or form.  The sheet number right now is a read-only property.  That's the issue.  I can get the sheet number in a script, I haven't figured out a way to change the value.


                I also understand the new page number system.  That isn't the focus here.  If an engineer moves the sheets around and uses this naming method, he/she has to manually rename the numeric portion of the name.  Using the page numbers created by Scout, we'd like to automate that process.



                • 5. Re: How can I change the sheet number in a script?

                  Yes, the system property is read only, but any "uesr" property is read/write.


                  Please read that last link I added.  It is a script to do what you want, but you have to add a "user" property to each sheet symbol and make the system one hidden, or just remove it.  The poster added a note on what needs updated to work with any system, and it looks like after just a touch of tweaking, it would work with any setup.  Yes, it supports named sheets, yes it does things automatically, but supports manual running of scout if needed.  At least that would be a good starting point for a complete system.


                  We use both the @SHEET (default) and page_num (currently requires instructions and manual editing of the visibilty of the 4 properties, hoping to automate someday), as the defaults work fine if you do not rename sheets or use hierarchical designs, which some of our simpler designs do.  If you do use either of these features, you can NOT use the @SHEET or @SHEETTOTAL.  (well, you can use the @SHEETTOTAL for renames, just not hierarchical designs)

                  • 6. Re: How can I change the sheet number in a script?

                    I'm not sure you understand the problem yet.


                    If the user moves the sheets around as shown below, how do you change the number only part of the sheet number string and make it correct in a script so that the first sheet number would show "1 - Other Circuit" and the second sheet number would show "2 - TopBlock"?  THat's the problem I'm trying to resolve.  I don't think a user property will work here.  Also I believe the PDF Table of Contents will only show the sheet  name/sheet number.  I don't think the TOC will show any user properties.


                    01-18-13 12-02-30 PM.png



                    • 7. Re: How can I change the sheet number in a script?

                      OK, found the new property for 7.9.3 and higher, see:




                      There are some things you'll need to do to use this, but making this new property visible is not required, just calling the functions to generate the value would be.


                      Note that you do not need to have @PRINTORDER on the border, you can just read the value in code.


                      I can see two ways of doing what you want.  Again, please look at that last link I sent you.


                      It looks like the link I provides in the earlier message uses the sheet/instance name to set the page number, and then stores that someplace to use later.  That way the sheet name can be anything, and you set the page number  to a string, and that can be anything you wish!.  I'm not sure if his page number uses a string or a number.  It should be easy to change to a string if he uses a number.  Again, this would require user interaction.  (but the code he uses would be good to look at as a starting place!)


                      The other way, using the example you supplied, is to grab the text (the page number) at the beginning of the sheet name, remove the leading number and replace it with the correct number (@PRINTORDER).  So you would grab the "1" out of the string "1 - Top Block", giving you " - Top Block" then merge @PRINTORDER to that, so now you have "2 - Top Block" and push that into a user property on the block's symbol.  This assumes they always put the number at the beginning, and then either a space or a "-".  This would even work with blocks, except your code to get the page name would be a little harder to write, as the instance name is much more complex on blocks.  (again, see that earlier link I sent, as he has even shown blocks/instanes getting page numbers)   I would use the new @PRINTORDER property to get the correct page number, if using 7.9.3 or higher.  You'll have to read up on that.  If you are using an older version, you'll have to make another user property and use scout to generate a number, if you want it all to be automatic.


                      In any case, you need to create user properties and add it to all border symbols to replace the @SHEET.


                      BTW, I know you can do something like this, as I've seen example code somewhere that would create the entire string "Sheet 1 of 10" instead of "Sheet" @SHEET "of" @SHEETTOTAL "Sheets" that most people currently use.  In other words, they had code that merged the 5 strings together, and place that into a user property instead of having a fixed text of "sheet", "of", "sheets" and sticking the @SHEET and @SHEETTOTAL in the middle of them.  This, in some ways, works better than the default, as the text spacing is even.


                      The PDF page numbering can be handled also.  (You set a "Schematic Sheet Order Property" to anything, as the default is blank)  I'm not sure what the limits are, strings vs. numbers.  See the link in this post for that, as I think it talks about using @PRINTORDER for the PDF too, and I think this is used for page ordering, but I'm not sure.

                      • 8. Re: How can I change the sheet number in a script?

                        Let's forget about what's displayed on the Border of a schematic sheet.  You are correct, there are many ways to display page numbers on schematic sheets.  I know how to do that.


                        All I'm interested is being able to change the sheet number that is displayed in the Project Navigator window (shown below) using a script.  That's all I want to do.  Not the sheet number displayed on a schematic.  I can do this manually today, I want to know how to do it in a script.


                        01-18-13 12-02-30 PM.png

                        • 9. Re: How can I change the sheet number in a script?

                          Gotcha.  You want to change the "sheet name" base on the order in the navagator.  (the "sheet name" is not the same as the "page number")


                          I'm sure there is an API call for this, but that's beyond my pay grade, sorry can't help with that.  You'll have to wait until a "real" programmer sees this.  I know what you can do with the system, but not the guts of the system.



                          BTW, you mght be able to do this with new @PRINTORDER property anyway, without programming.   See link above.

                          • 10. Re: How can I change the sheet number in a script?

                            Hi Tony,


                            I don't know of any simple way to rename the sheet number - it used to be SaveAs, but that method was disabled with iCDB.


                            The only way I can think of is to use CopyToClipboard, InsertSheet, PasteFromClipboard, and then DeleteSheet on the original.



                            1 of 1 people found this helpful
                            • 11. Re: How can I change the sheet number in a script?

                              Thanks John,  I think I'll go add an enhancement request in the Idea's site.