PDA

View Full Version : Attribute passing from Annotation to Model Manager


alexniccoli
04-20-2006, 02:47 AM
Hi All
How can i pass attribute values(think about SCALE) from Annotation to Model Manager?
I use Model Manager 13.20A but in 2D_drawing/sd_drawing attribute SCALE
is empty.
I see that release 14.00 solve this problem,but i don't want install this release now.
Some solution?

Thanks a Lot

alexniccoli
04-26-2006, 01:21 AM
Hi all
I don't think that nobody met this problem with releases 13 and have found some solution to this problem.
Follow my solution:

lisp macro annotation:
(in-package :acme)
(use-package :oli)

(let ((original-save (symbol-function 'db-2d-aip-ui::db-save-2d-data-doit)))

(defun my-save(&rest args)
(setq dwgno(oli::sd-am-inq-drawing-no) )
(setq esiste (probe-file (concatenate 'string "C:/temp/exchange" dwgno)))
(if (probe-file (concatenate 'string "C:/temp/exchange" dwgno))
(delete-file (concatenate 'string "C:/temp/exchange" dwgno))
)

(setq scala (DOCU::DOCU_INQ_CURR_SHEET_SCALE_TEXT))
(setf file-stream (PrivoxyWindowOpen(concatenate 'string "C:/temp/exchange" dwgno) :direction :output))
(write-line scala file-stream)
(close file-stream)

(apply original-save args)
(funcall original-save)

)

(setf (symbol-function 'db-2d-aip-ui::db-save-2d-data-doit) (symbol-function 'my-save))
)

tag xml into sd_drawing 2D_drawing customization:

<PreApplyListener>com.acme.biz.PreApplyListenerDrawingSD</PreApplyListener>


java code into method public void preApply(WMApplyEvent e) of class reApplyListenerDrawingSD

...
boolean b;
Drawing myDwg;
myDwg = (Drawing)e.getSource();

FileInputStream fin;
String scale = "";
try
{
String name = myDwg.getName();
fin = new FileInputStream ("C:\\temp\\exchange" + name);

// Read a line of text
scale = new DataInputStream(fin).readLine() ;
scale = scale.trim();
// Close our input stream
fin.close();
File myFile = new File ("C:\\temp\\exchange" + name);
myFile.delete();
}
// Catches any error conditions
catch (java.io.IOException ex)
{
System.err.println ("Unable to read from file");

}

if (!scale.equals(""))
myDwg.setValue("SCALE",scale);

...

John Scheffel
04-26-2006, 10:19 AM
Thanks for posting the information. Here are some tips for posting LISP code in this forum.

If you enclose the LISP in code tags it will preserve the formatting and be easier to read. For example.


(Here is my
(indented LISP code))


In the post it will appear as follows

(Here is my
(indented LISP code))

It is also a good idea to check the "Disable smilies in text" check box. This will prevent some LISP items which begin with a colon from being converted into Smilies. I edited your post above and set this option to eliminate the smilies.