Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Update DMS Folder ID
    • Sign In

    • State Not Answered
    • Replies 8 replies
    • Subscribers 66 subscribers
    • Views 323 views
    • Users 0 members are here

    Update DMS Folder ID

    Dave Cole
    Offline Dave Cole 5 months ago

    I am looking for a cmdlet that will update the dms folder ID of an existing folder to a new number. We use the PDF rendition service across multiple datasources and maintaining the settings file (*.set) is tedious since the file can only be edited using InterPlot. The thought is that having the same folder ID in each datasource for these SET files would allow those files to be synced to other datasources, thereby allowing us to make one update with InterPlot and have that SET file sync to all the other datasources. These files don't change often (usually when we add capability) but the folder ID update ability would be handy.

    • Sign in to reply
    • Cancel

    Top Replies

    • Kevin van Haaren
      Offline Kevin van Haaren Wed, Mar 29 2023 5:36 PM in reply to Kevin van Haaren +1
      This is the powershell I use to sync files from one datasource to multiple destination datasources. If I remember correctly Copy-PWDocumentsBetweenDatasources was either really slow when I was copying…
    • Bill Graefe
      Offline Bill Graefe Mon, Apr 3 2023 12:07 PM in reply to Brian Flaherty +1
      I've deduced most of the data model as Bentley would not supply the ERD when asked. Keyword: Most . No way I'd go that route especially after only just finding out what o_instanceid is on dms_proj. Something…
    • Kevin van Haaren
      0 Offline Kevin van Haaren Wed, Mar 29 2023 12:53 PM

      Set files can also be be text files and edited with any text editor, I keep all my set files for renditions in projectwise as text files.

      you have to edit the database to modify a specific dms number and I think there maybe potential issues with how it keeps track of assigning the next number.

      I have a powershell script I can use to sync a file across multiple datasources, let me check.

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Dave Cole
      0 Offline Dave Cole Wed, Mar 29 2023 1:24 PM in reply to Kevin van Haaren

      The set files I see have a binary component to them (but they were generated using InterPlot). You can open and view them with a text editor but when you save and try to use them, they won't work. Maybe an encoding issue (using Notepad++). I will try just using them as plain ASCII text and see if that works.

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Wed, Mar 29 2023 5:16 PM in reply to Dave Cole

      If you create them with Iplot they will be binary, you can just create them with a text editor.

      This is the default one i start with for projects using sheet models

      model=IP_SHEETDEF_MODELS
      plot_area=sheet
      paper_size=22x34
      full_sheet=true
      maximize
      center
      nodisplay[iplot_all]=[construction,text_nodes,ref_boundaries,enter_data]
      color_table="IP_PWP:d#######\color.tbl"
      design_script="IP_PWP:d#######\ICS_designscript_bw.dscript"
      ms_pen_table="IP_PWP:d#######\ICS_pentable_bw.tbl"
      

      I just need to edit the d####### entry (I haven't yet, but i'll probably script this in PowerShell)

      this is my instructions I keep with the set files so I can remember the most frequent commands I need, plus all the little rules I've found over the years (some may not be exactly correct but following them seems to minimize issues)

      # Notes:
      #	1. Don't put comments in these files, renditions doesn't always like them
      #	2. If list only one item don't put it in [] (e.g. area_colors=4 instead of area_colors=[4])
      #	3. Don't put spaces around the =
      #	4. If multiple items are show below, but they aren't in [] that means pick only one
      #	5. Put most names (logical names, level names, paper names, etc..) in "", required if name has a space in it
      #	6. If setting an odd paper size, check with CADD Support to make sure it's available on the server
      #	7. If this file is in the same projectwise folder as your color table/design script/pen table you can use the
      #	   working directory this file is in for the d###### folder below.
      #	8. Not all options are shown below, for more info check the InterPlot help.
      model=IP_SHEETDEF_MODELS | IP_DESIGN_MODELS | model_name | "partial_name*" | [model_name,model_name...]
      plot_area=fence | sheet
      area=shape | all_shapes
      area_files=[logical_name1,logical_name2]
      area_levels=[level1,level2,...]
      area_colors=[0,1,...,255]
      area_styles=[1-3]
      area_weights=[0,1,...,31]
      paper_size=11x17 | 24x36 | "ANSI D" | ...
      full_sheet=true
      maximize
      center
      nodisplay[iplot_all]=construction,text_nodes,ref_boundaries,enter_data
      nodisplay[ref1,ref2]=file
      nolevels="NO_PLOT*"
      color_table="IP_PWP:d#######\color.tbl"
      design_script=IP_PWP:d#######\ICS_designscript_bw.pen"
      ms_pen_table="IP_PWP:d#######\ICS_pentable_bw.tbl"
      

       

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Kevin van Haaren
      0 Offline Kevin van Haaren Wed, Mar 29 2023 5:36 PM in reply to Kevin van Haaren

      This is the powershell I use to sync files from one datasource to multiple destination datasources. If I remember correctly Copy-PWDocumentsBetweenDatasources was either really slow when I was copying between multiple destinations or there was a bug stopping it from working when I tried it.

      This first copies out the files from the source, then logs into each destination and uploads the file to the same location in that datasource. When I was looking at this I think it may fail if the file doesn't already exist in the destination but that should be easy to catch and work around.

      $workspaceRoot = "CADDLib\Connect\Standards"
      
      $files = @(
      	'Standards.cfg'
      	'Macros\Example.mvba'
      )
      
      $Source = 'intsvr:dsource1'
      $Dest = @(
      	'intsvr:dsource2'
      	'intsvr:dsource3'
      	'intsvr:dsource4'
      )
      
      Write-Host "Logging into $($Source)"
      if (-not (New-PWLogin $Source -BentleyIMS)) {
      	Write-Error "Login to $($Source) failed"
      	Exit 1
      }
      
      Write-Host "Retrieving files from $($Source)"
      $fileList = @()
      ForEach ($f in $files) {
      	$pwPath = Join-Path $workSpaceRoot $f
      	Write-Host "Copying out $($pwPath)"
      	$pwd = Get-PWDocumentsBySearch -FolderPath (Split-Path $pwPath -Parent) -FileName (Split-Path $pwPath -Leaf)
      	if ([string]::IsNullOrEmpty($pwd)) {
      		Throw "Unable to locate document $($pwPath)"
      	}
      	$fileList += [PSCustomObject]@{
      		'PWPath' = $pwPath
      		'Local'  = $pwd.CopyOut()
      	}
      }
      
      Write-Host
      
      ForEach ($d in $dest) {
      	Write-Host "Updating datasource $($d)"
      	if (-not (New-PWLogin $d -BentleyIMS)) {
      		Write-Error "Login to $($d) failed"
      		Exit 1
      	}
      	ForEach ($f in $fileList) {
      		Write-Host "Updating File: $($f.PWPath)"
      		$pwd = Get-PWDocumentsBySearch -FolderPath (Split-Path $f.pwPath -Parent) -FileName (Split-Path $f.pwPath -Leaf)
      		$pwd | New-PWDocumentVersion > $null
      		$pwd | Update-PWDocumentFile -NewFilePathName $f.Local -KeepExistingFileName > $null
      	}
      }
      

       

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Dave Cole
      0 Offline Dave Cole Mon, Apr 3 2023 10:30 AM in reply to Kevin van Haaren

      Thanks Kevin!

      • 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