PASTEASREFERENCE Command
Description
Appends one custom reference file to a source file or to files found by search in SOLIDWORKS PDM.
The pasteasreference command uses filePath as the reference file to append. Use source to append that reference to one file, or use search to append that reference to multiple matching files.
This command is useful when a workflow creates or finds a supporting file and then needs to append it as a custom reference to one or more target files.
Syntax
pasteasreference -filePath reference_file (-source source_file | -search search_query) [-recursive]
Parameters
filePathRequired. Reference file to append.sourceOptional. Single file that will receive the appended reference. Use eithersourceorsearch.searchOptional. Search query used to find files that will receive the appended reference. Use eithersourceorsearch.recursiveOptional. When used withsearch, includes matching files in subfolders.
Validation
filePathis required.- Specify either
sourceorsearch, but not both. recursiveis only valid when used withsearch.
Behavior
- Appends the
filePathreference to each selected target file. - Does not clear existing custom references.
- Uses a quantity of
1for the appended custom reference. - Skips a target file if it is the same file as
filePath. - Skips duplicates.
Examples
# Append Part.sldprt as a custom reference to one assembly
pasteasreference -filePath "Part.sldprt" -source "Assembly.sldasm"
# Append Part.sldprt as a custom reference to all matching assemblies in the current folder
pasteasreference -filePath "Part.sldprt" -search "Name=%.sldasm"
# Append Part.sldprt as a custom reference to matching assemblies in the current folder and subfolders
pasteasreference -filePath "Part.sldprt" -search "Name=%.sldasm" -recursive
Remarks
- This command modifies custom references directly in SOLIDWORKS PDM.
- Existing custom references are preserved.
- If the selected target already has the reference, PDMShell reports it and does not add a duplicate.
Availability
Available since PDMShell 4.0.0.