cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Edit Drawing Program with JLink or Toolkit

Eike_Hauptmann
15-Moonstone

Edit Drawing Program with JLink or Toolkit

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



This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
6 REPLIES 6

Eike,
I would create a ticket with PTC TS to ask how to export the Drawing Program. I also saw the documentation for ProOutputFileWrite that states the following:


ProMdl<proobjects_h.html#promdl> model


/* (In)


A pointer to the model.

* PRO_IGES_FILE<proutil_h.html#pro_iges_file> and PRO_DXF_FILE<proutil_h.html#pro_dxf_file> work for drawings only.
* PRO_PROGRAM_FILE<proutil_h.html#pro_program_file> works for parts and assemblies only.
* For CL data, this pointer must reference a manufacturing model.


*/



Patrick Williams | Engineering Systems | o: 616.698.3766 | c: 616.947.2110
[cid:image001.jpg@01CCA84A.B40D0460]

Also Pro2dImportCreate() has entry for program as -



PRO_PROGRAM_FILE = 4,


/* Import & Export */
FV
17-Peridot
17-Peridot
(To:Eike_Hauptmann)

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 :



  • PRO_STEP_FILE

  • PRO_SET_FILE

  • PRO_IGES_FILE

  • PRO_MEDUSA_FILE

  • PRO_DXF_FILE

  • PRO_DWG_FILE

@ 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

Announcements


Top Tags