#1
|
||||
|
||||
OSD => Save current WP into .mi file
How can i save current WP into a .mi file?
PHP Code:
Some help? TNX |
#2
|
||||
|
||||
Re: OSD => Save current WP into .mi file
Workplanes are stored as 3D data, not 2D (*.mi) so it's not going to happen.
It is also not possible to copy the 2d Data from a workplane and paste it into Annotaton or Drafting |
#3
|
||||
|
||||
Re: OSD => Save current WP into .mi file
The command exist, everyday i use this command
From OSD: Save => Data 2D (.mi) => I select a workplane => name_file_out.mi => OK So i need only a macro that select in automatic the current workplane |
#4
|
|||
|
|||
Re: OSD => Save current WP into .mi file
To store the geometry from a workplane I use this code in a macro of mine:
Code:
(sd-call-cmds (MI_OUT :filename name_of_file :overwrite :select name_workplane ) |
#5
|
||||
|
||||
Re: OSD => Save current WP into .mi file
are you sure it works?
Ti give me error.. :/ |
#6
|
|||
|
|||
Re: OSD => Save current WP into .mi file
It works fine by me. i use this in a macro to make slices of a 3D object so I can use these contours on a 2.5D milling machine.
|
#7
|
||||
|
||||
Re: OSD => Save current WP into .mi file
Look at this:
I don't understand.. |
#8
|
|||
|
|||
Re: OSD => Save current WP into .mi file
You should try the following:
Code:
(sd-call-cmds (MI_OUT :overwrite "c:/Temp/wp.mi" :select "/w1" ) ) |
#9
|
||||
|
||||
Re: OSD => Save current WP into .mi file
For me works grest this:
PHP Code:
|
#10
|
||||
|
||||
Re: OSD => Save current WP into .mi file
I have upgrade my code
But sometimes (i think the first time) give me error and then works well Someone can help me? TNX PHP Code:
|
#11
|
|||
|
|||
Re: OSD => Save current WP into .mi file
Hi All,
It's a very very old post but i try save WP in MI with right button menu context. I wrote that for menu: (sd-browser-add-popup-entry "parcel-gbrowser" :entry-type ush :label (sd-multi-lang-string "Save WP as..." :french "Enregister PdT sous..." ) :is-entry-applicable 'IsWPObj :menu-action 'saveWP :new-group t ) and then, the function: (defun saveWP (obj name) (mi_out :filename (format nil "~A.mi" (string-upcase (sd-inq-obj-basename obj))) verwrite :select (BrowserNode-objPath obj)) ) Doesn't works ! And Modeling crash....Any idea ?? |
#12
|
|||
|
|||
Re: OSD => Save current WP into .mi file
Hi Fred,
The reason it doesn't work is that calling functions from the structure browser uses different object types (and when the call fails, it can crash Modeling as you noticed). The problems are in the saveWP function -- you're trying to get the basename of a browser object, which is different from a regular Modeling object. One thing that can help with functions like this is to break the "decoding" into multiple steps so you can check them along the way. Also, if you use "sd-put-buffer" to make the call, it's less likely to crash Modeling since calls made from the command-line (which is essentially what sd-put-buffer does) have much more robust error handling. You could also have the popup call a dialog, which would also provide more robust error handling. So, if you make the function have a few more steps, it should work: Code:
(defun saveWP (obj name) ;; create some temporary variables for this function to use (let (path fname cmdstr) ;; extract the path to the Modeling object (setq path (BrowserNode-objPath obj)) ;; create the filename. Note that we first need to get the object pointed to ;; by the path, and then get that object's basename (setq fname (format nil "~A.mi" (string-upcase (sd-inq-obj-basename (sd-pathname-to-obj path))))) ;; create the command string that we want to execute, including quotes (setq cmdstr (format nil "mi_out :select \"~a\" :filename \"~a\" :overwrite" path fname)) ;; now execute the command string as though we had typed it into the user input line (sd-put-buffer cmdstr) ) ) andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#13
|
||||
|
||||
Re: OSD => Save current WP into .mi file
I have this macro, that takes a workplane, saves it as an MI file and then loads it into annotation.
Code:
(sd-defdialog 'wp2anno :dialog-title "WP to Annotation" :variables '( (wptje :initial-value (sd-inq-curr-wp) :value-type :wp :title "Workplane") ) :local-functions '( (doit () (mi_out :select :workplane wptje :FILENAME "C:/working/out/plot.mi" :OVERWRITE ) (AM_LOAD_ANY_MI :FILENAME "C:/working/out/plot.mi") ) ) :ok-action '(doit) )
__________________
Tom Kirkman Creo Elements/Direct 20.1 Dell Precision 3581 https://www.o-i.com |
#14
|
|||
|
|||
Re: OSD => Save current WP into .mi file
Hi Andy,
I'm very happy somebody answer me :-)....I was very surprise too, to have very quickly answer ! Nice !! Of course, it works ! I will follow your advices to upgrade this program because, in fact, i want to select more than one WP from Browser and then, store them. Very happy this forum is still alive ! Thank you for your help |
#15
|
|||
|
|||
Re: OSD => Save current WP into .mi file
Hi Tom,
Thank you too for your anwser. Like i said, it's very plaisant to see this forum is still alive. Many thanks. I'm realy new in LISP Modeling code. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|