Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi,
I have a issue about edit the code I find under "Drawing Program". I try to use com.ptc.pfc.pfcModel.ProgramExportInstructions but this ones only causes a jxthrowable. With parts and asemblys everything works ok.
So I learned that "ProProgram" and "DrawingProgram" are different things. I need a way to export and to reimport the code, because I want to link the parameters from a drawing to parameters of the current model in the drawing. I think the some parameters would help to simplify the search and handle of drawings inside of a pdm system.
I don't find a way to change these code in Toolkit too. So have everyone do this before, or have a idea how to do it?
Best regards,
Eike
Also Pro2dImportCreate() has entry for program as -
PRO_PROGRAM_FILE = 4,
Hi all,
Eike,
There is an old pro/etrick to use config.pro pro_editor setting to point it to your IO stream processing utility. The utility has to use blocking IO.
HIH.
Feliks.
In Reply to Eike Petersen:
Hi,
I have a issue about edit the code I find under "Drawing Program". I try to use com.ptc.pfc.pfcModel.ProgramExportInstructions but this ones only causes a jxthrowable. With parts and asemblys everything works ok.
So I learned that "ProProgram" and "DrawingProgram" are different things. I need a way to export and to reimport the code, because I want to link the parameters from a drawing to parameters of the current model in the drawing. I think the some parameters would help to simplify the search and handle of drawings inside of a pdm system.
I don't find a way to change these code in Toolkit too. So have everyone do this before, or have a idea how to do it?
Best regards,
Eike
@ Patrick : Thank u very much.
@ Rahul : Thats a nice idea, but same problem as write in file, only support :
@ Feliks: Very nice idea, I try it : )
((Aunt Edit: change J.D. to Feliks, sry Feliks ^.^ Thank you! ))
@Eike:
Did you tried method suggested by Feliks?
Will it be possible for you to share more details on how to use to it?
Thanks,
Rahul
Weeks later,
Everything works allright. Its not a perfekt solution, an API function would be better, but it works : )
I've used a C# Program to get the Input and Output stuff.
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
namespace PROTKIO
{
class Program
{
static void Main(String[] args)
{
String dir = Environment.GetEnvironmentVariable("appdata");
String pathProTk = dir + "\\FOLDER\\protkio.txt";
String pathPtoTkFini = dir + "\\FOLDER\\proiotkfini.txt";
if (args.Length > 0)
{
Console.Out.WriteLine("Something is going on");
StreamWriter myfiniWriter = File.CreateText(pathPtoTkFini);
myfiniWriter.WriteLine("0");
myfiniWriter.Close();
StreamWriter myWriter = File.CreateText(pathProTk);
String line = ";
using (StreamReader myReader = new StreamReader(args[0]))
{
while ((line = myReader.ReadLine()) != null)
{
myWriter.WriteLine(line);
}
}
myWriter.Close();
myfiniWriter = File.CreateText(pathPtoTkFini);
myfiniWriter.WriteLine("1");
myfiniWriter.Close();
Console.Out.WriteLine("Ready for wainting");
Boolean wait = true;
while (wait)
{
try
{
String finiline = ";
using (StreamReader myFiniReader = new StreamReader(pathPtoTkFini))
{
finiline = myFiniReader.ReadLine();
if (finiline == "2")
{
wait = false;
}
}
}
catch (Exception ex)
{
Console.Out.WriteLine("Uuuuh ... got an exception : ) I think another program is writing my files");
}
}
Console.Out.WriteLine("Hei ho someone has freaking my code. Time to write back");
StreamWriter myNewWriter = File.CreateText(args[0]);
using (StreamReader myReader = new StreamReader(pathProTk))
{
while ((line = myReader.ReadLine()) != null)
{
myNewWriter.WriteLine(line);
}
}
myNewWriter.Close();
Console.Out.WriteLine("Finished the crapwork");
}
else
{
Console.Out.WriteLine("You need more arguments");
}
}
}
}
Best regards,
Eike