Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum how to count the number of sheet views in a DGN?
    • Sign In

    • State Not Answered
    • Replies 7 replies
    • Subscribers 67 subscribers
    • Views 1434 views
    • Users 0 members are here
    • MicroStation
    • ProjectWise

    how to count the number of sheet views in a DGN?

    Kirk Peterson
    Offline Kirk Peterson over 4 years ago

    hello - I have written a Powershell script to run with ProjectWise, to generate renditions (PDFs) based on several criteria.  The last hurdle is to automatically handle a comparison so that the script will 'know' which models have only one plot sheet, and which have multiple sheets. 

    Is this possible?  I would envision: (1) Powershell script kicks off, (2) for each folder, the script calls this new 'widget' that assess each DGN file in a folder, and writes out to a CSV file, or spreadsheet, the number of sheets in each file.  If I can get the info out of PW and the DGN files, and into a separate file, I can take it from there.

    thanks!
    Kirk Peterson (Stantec)

    • Sign in to reply
    • Cancel
    • Jan Šlegr
      0 Online Jan Šlegr Wed, Jun 5 2019 12:14 AM

      Hi Kirk,

      this is MicroStation programming forum, so I recommend to move your question to ProjectWise one. Use More > Move tool under your original post.

      Regards,

        Jan

      Bentley Accredited Developer: iTwin Platform - Associate
      Labyrinth Technology  |  dev.notes()  |  cad.point

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Mon, Jun 10 2019 5:22 PM

      I don't know of a way for PowerShell to extract info about the models in a DGN file. You'd have to have PowerShell launch microstation with instructions to run a VBA or MDL to do what your want then exit. I'm not even sure this is possible in a batch mode.

      Is there a reason you can't use the Rendition Server? There is a PowerShell cmdlet for submitting jobs to Renditions so you could use your PowerShell to figure out which files need to be rendered, then submit them to the rendition server for you and let it handle the models?

      NAME
          New-PWRenditionRequest
      
      SYNOPSIS
          Submits a rendition request for documents passed through the pipeline. Takes an optional Rendition Profile name.
      
      
      SYNTAX
          New-PWRenditionRequest [-InputDocuments] <ProjectWiseDocument[]> [[-ProfileName] <string>]
          [[-MakeSinglePlotRequest] <SwitchParameter>] [<CommonParameters>]
      
      
      DESCRIPTION
      
      
      PARAMETERS
          -InputDocuments <ProjectWiseDocument[]>
              Array of document objects from the pipeline.
      
          -ProfileName <string>
              Rendition Profile name. Must exist.
      
          -MakeSinglePlotRequest <SwitchParameter>
              Make one plot request for multiple documents.
      
          <CommonParameters>
              This cmdlet supports the common parameters: Verbose, Debug,
              ErrorAction, ErrorVariable, WarningAction, WarningVariable,
              OutBuffer, PipelineVariable, and OutVariable. For more information, see
              about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
      
          ----------  EXAMPLE 1  ----------
      
          #Example usage for creating and submitting a rendition request.
          #Get documents and submit for plotting.
          Get-PWDocumentsBySearch -FolderPath "Test 6\Projects 2" -FileName %.dgn -JustThisFolder | New-PWRenditionRequest
          -ProfileName "For Construction"
      
      REMARKS
          To see the examples, type: "get-help New-PWRenditionRequest -examples".
          For more information, type: "get-help New-PWRenditionRequest -detailed".
          For technical information, type: "get-help New-PWRenditionRequest -full".

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kirk Peterson
      0 Offline Kirk Peterson Mon, Jun 10 2019 5:29 PM in reply to Kevin van Haaren

      hey Kevin van Haaren...I have a Powershell script already written. But, if I setup the renditions to plot all sheets (which works), it adds a 'sheet 1 of x' to the pdf name.  That's good.  However, if the DGN has only one sheet, it says "sheet 1 of 1", which is pretty worthless.  So, I was hoping to be able to determine if the DGN's have one sheet, or multiple sheets, to better control the file names.

      thanks!
      Kirk

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Tue, Jun 11 2019 10:02 AM in reply to Kirk Peterson

      been trying to think of a way to accomplish this and honestly the only thing i really came up with is to run a process after the file is done rendering, check the name and if it contains "Sheet 1 of 1" rename it to remove that.

      Only other thought is an attribute that tags if it's multisheet or not, but that requires users to remember to tag them, which is probably unreliable.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kirk Peterson
      0 Offline Kirk Peterson Mon, Jun 17 2019 11:32 AM in reply to Jan Šlegr

      Hi Jan - Thanks for the suggestion, but since there isn't a way to accomplish this with PW and/or Powershell, I figure it belongs in this forum.

      regards,

      Kirk

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    >

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies