Select File

Select File

Anonymous
Not applicable
5,880 Views
29 Replies
Message 1 of 30

Select File

Anonymous
Not applicable

Hi, is there a way to open explorer already in the current Powermill project?
Macro place to make it clear what I mean.
thanks

0 Likes
Accepted solutions (1)
5,881 Views
29 Replies
Replies (29)
Message 2 of 30

TK.421
Advisor
Advisor

is this what you're looking for:

STRING fld = project_pathname(0) + "/"
OLE FILEACTION "OPEN" $fld

the numbers never lie
0 Likes
Message 3 of 30

Anonymous
Not applicable

Hi, I was interested in opening this Powermill window in the current project and not explorer Windows.
Thanks

0 Likes
Message 4 of 30

TK.421
Advisor
Advisor

oh, i see what you mean


the numbers never lie
0 Likes
Message 5 of 30

Anonymous
Not applicable

Sorry, I'm trying to open this Di Powermill window in the
current project folder:

 

 

STRING $folder = project_pathname(0) + "/"
MKDIR $folder
$folder=FILESELECT "Select File "

 

 

0 Likes
Message 6 of 30

TK.421
Advisor
Advisor

are you trying to import something else into your current session? what's the end goal?


the numbers never lie
0 Likes
Message 7 of 30

Anonymous
Not applicable

You can import a model in .ddz format using the batc file
I wanted the explorer to open up already in the right director which would be that of the current project.
I attach complete macro to make you understand

0 Likes
Message 8 of 30

TK.421
Advisor
Advisor

I dont know what a ddz file is. can you expand on that (for my own benefit).

 

As far as your macro goes, you can determine the file path of said file and then import it that way? you could do that without having to even interface with the file open dialog.

 

IMPORT MODEL $ddzModelPath

 

if you have multiple ddz files, you can put them in a pull down menu

 

 


the numbers never lie
0 Likes
Message 9 of 30

Anonymous
Not applicable

I state that I use many parasolid .x_t filesPowermill automatically converts them to .dgk. .ddz files are opened directly in Powermill because they are Powermill files, however they are 3 times smaller than a .dgk file. I've been using them for about a month and check if Powermill's plans are actually lighter. The macro converts a parasolid x_t to .ddz by opening it in Powermill via Manufacturig data excange. What I need is that when I run the macro, the explorer that opens is already in the current project folder and not in a random one.
Sorry English but I use a translator.
Thanks for your help.

0 Likes
Message 10 of 30

TK.421
Advisor
Advisor

your english is good, dont worry. I'm slow to understand. I'm working at this now.

 

so you use ddz files because they are smaller? does powermill run faster with those?


the numbers never lie
0 Likes
Message 11 of 30

Anonymous
Not applicable

I'm checking it these days it seems so, but I'm waiting for a heavy project to have a confirmation.

0 Likes
Message 12 of 30

TK.421
Advisor
Advisor

I know what you're asking now, but I dont know if theres a way to do it. I map the user paths to specific directories to help with shortcuts. One is a temp folder on my desktop where I keep all the projects I'm actively working on

Capture.PNG


the numbers never lie
0 Likes
Message 13 of 30

Anonymous
Not applicable

Please test it:

INCLUDE OpenFileDialogMulti.INC
FUNCTION MAIN() {
// OpenFileDialogMulti() sample macro
// This macro calls the Powershell script, and
//  may need to be configured for the operating system to run properly.
//  Talk to your system administrator.
// TempDir: the macro working directory, require write access
   STRING TempDir='c:\Temp'
   STRING StartDir=project_pathname(0)
   IF $StartDir == '' {
      MESSAGE INFO 'Please save the project'
      RETURN
   }
   STRING Prompt='Please select .ddz files'
   STRING Extension='ddz'
// IsMulti: Allow multiple select
   BOOL IsMulti=TRUE
   STRING LIST Result={}
   CALL OpenFileDialogMulti($TempDir,$StartDir,$Prompt,$Extension,$IsMulti,$Result) 
   STRING Msg=''
   FOREACH F IN $Result {
      $Msg=$Msg+crlf+$F
   }
   $Msg='Selected files:'+$Msg
   MESSAGE INFO $Msg 
}

 

0 Likes
Message 14 of 30

Anonymous
Not applicable

I'm sorry I can't get it to work.

However the macro I posted above works well converts .x_t to .ddz I just wanted to shorten the choice of the x_t file which is always inside the current Powermill project and I would like that when you open the file selection window it was already in the correct path and not on a random path.

 

0 Likes
Message 15 of 30

Anonymous
Not applicable

I just realized that just press on the top left to enter the current project folder, see attachment.
Sorry if I made you waste time. Thanks

0 Likes
Message 16 of 30

Anonymous
Not applicable

Oops!
The project_pathname(0) function gives this result: c:/akarmi/xxx
but Powershell is expecting c:\akarmi\xxx. Bug fixed:

FUNCTION OpenFileDialogMulti (….) {
.
.
$StartDir replace $ = ($ StartDir, '/', '\')
.
.
}

 

0 Likes
Message 17 of 30

Anonymous
Not applicable

He gives me this message

0 Likes
Message 18 of 30

Anonymous
Not applicable

a. Set the $TempDir variable to a valid directory (with write access)

b.  This macro calls the Powershell script, and   may need to be configured for the operating system to run properly.
  Talk to your system administrator.

0 Likes
Message 19 of 30

Anonymous
Not applicable

Hi, I checked the TEMP folder for permissions it seems to me all ok look attached.
The powershell scripts I can run them see macro at post 7 but I always have the same error

0 Likes
Message 20 of 30

Anonymous
Not applicable

Please run this macro.
If all goes well, you will find 4 files in the c:\temp directory:
tmp.bat,tmp.ps1,tmp.log,success.tmp.

Open Command Prompt window ( Start Menu Search -> cmd)
Type:
'c:'
'cd c:\temp'
'powershell -file tmp.ps1'
Take a snapshot of the result, and upload result files

 

0 Likes