Reply

automation - macro for few files

Hi friends...

 

Could you tell me how mark files to apply a macro.. i mean something like BATCH, i click to folder browse and then i get a list of files... then i`ll mark which files have to by modify.

 

4 REPLIES

Re: automation - macro for few files

Hi lauren86,

 

First you need to set the SelectionMode property of the ListBox to MultiExtended.

This will enable picking multiple files using Ctrl and Shift keys.

 

The following worked for me:

 

Dim sFiles As String = String.Empty

For Each oItem As Object In lstfiles.SelectedItems
  sFiles += oItem.ToString + Environment.NewLine
Next

MessageBox.Show(sFiles)

 

This will give you the filenames picked which you can use in Solid Edge.

 

 

Hope you find this useful.

 

BR,

Tushar Suradkar

http://surfandcode.blogspot.in

www.cadvertex.com

 

Re: automation - macro for few files

And maybe someone could help me, and give me example how correct add custom property ? thanks

Re: automation - macro for few files

Smiley Happy

 

Dim oPropertySets As New SolidEdgeFileProperties.PropertySets
Dim oProperties As SolidEdgeFileProperties.Properties
Dim oProperty As SolidEdgeFileProperties.Property
Dim sFileName As String

For Each obj As Object In lstFiles.SelectedItems Try sFileName = obj.ToString oPropertySets.Open(sFileName, False) oProperties = oPropertySets.Item("Custom") oProperty = oProperties.Add("Approved by", "Tushar") oPropertySets.Save() oPropertySets.Close() Catch ex As Exception Console.WriteLine(ex.Message) End Try Next

 

Regards,

 

Re: automation - macro for few files

Samples for Solid Edge on CodePlex is a good place to start. Be aware that there are several Solid Edge APIs for working with file properties depending on what you're doing.

 

Download solidedgesamples.codeplex.com.zip and extract.

 

To work with file properties inside of Solid Edge (SolidEdgeFramework).

  • Open \solidedgesamples.codeplex.com\cs\Samples\ApiSamples.sln
  • Execute the AddCustomProperties sample found under each document environment.

To work with file properties without Solid Edge running (SolidEdgeFileProperties).

  • Open \solidedgesamples.codeplex.com\cs\Demos\Demos.sln
  • Set FileProperties.ConsoleDemo project as startup and execute.
  • Set FileProperties.WinForm project as startup and execute.

You can actually work with file properties using the Revision Manager API but I don't have an example of that at the moment.

Jason Newell
Applications Architect
www.jasonnewell.net