#1
|
|||
|
|||
Macro Annotation
Hi!
I do this macro in LISP: (in-package :trive) (use-package :oli) (sd-defdialog 'GEOM_PART :dialog-title "From Geometry To Part" :dialog-control :parallel :variables '( (geometry :selection *sd-anno-geo-seltype* :multiple-item nil :title "Geometry" :prompt-text "Sel. geometry" :after-input (progn (display (format nil "Geometry seltype ~A" geometry)) (display (format nil "Geometry seltype ~A" (sd-am-inq-name geometry))) (display (format nil "Geometry ID ~A" (sd-get-annotator-reference :object geometry))) (display (format nil "Parameter 301 ~A" (sd-execute-annotator-function :fnc (format nil "From_geometry_to_part '~A' 301" (sd-am-inq-name geometry))))) ) ) ) :ok-action () ) (sd-execute-annotator-command :cmd (format nil "~a ~a ~a ~a ~a ~a ~a ~a ~a ~a ~a" "DEFINE From_geometry_to_part" "PARAMETER target_pid" "PARAMETER number_code" "LOCAL output" "INQ_ELEM target_pid" "LET output (INQ number_code)" "LET output (DOCU_CSTRING_TO_LSTRING output)" "(DOCU_OPEN_CONNECTION_TO_SD)" "(DOCU_ADD_LINE_TO_SD output)" "(DOCU_CLOSE_CONNECTION_TO_SD)" "END_DEFINE" ) ) This function works in Annotation. I select a geometry, line, circle... ecc. and the macro return the name of part. But I want also to return the complete path of the part... Now I have this, part But I want this /group/part... Thank you in advance Michele |
#2
|
||||
|
||||
Re: Macro Annotation
Drafting (and so the Annotator.exe) does not offer a INQ for the complete PATH as you would like to see.
You have to do a loop - change_part parent - inq_part . - inq part name - add part name to path ...... until you hit the root (part name = "/") I assume you should skip the last part added, since this will be the sheet number. Be aware that strings in Drafting are limited to 1023 chars. So concatenating all the part levels to one long string will break it sooner or later. TIP: Add all the levels to a LISP list returned to your dialog and create the long string over there with a simple PHP Code:
Code:
IKIT --- sd-pathlist-to-pathname oh.. and Michele, please use the [ code ] tag when writing code in this forum. Have a look to the 'BB code' link a the end of the page when writing a post.
__________________
Last edited by Wolfgang; 06-04-2010 at 09:00 AM. Reason: added hint to BB code |
#3
|
|||
|
|||
Re: Macro Annotation
Thank you for the replay...
But I don't understand very well... I look for the macro change_part... but I don't find it! If you do a little example... Thank you in advance Ciao Michele |
#4
|
|||
|
|||
Re: Macro Annotation
Hi Michele,
I believe the macro command Wolfgang meant is edit_part (rather than change_part) Does that help! 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! |
#5
|
|||
|
|||
Re: Macro Annotation
Hi..
Thank you for the response... I try with this macro Code:
(sd-execute-annotator-command :cmd (format nil "~a ~a ~a ~a ~a ~a ~a ~a ~a ~a ~a ~a" "DEFINE From_geometry_to_part_parent" "PARAMETER target_pid" "PARAMETER number_code" "LOCAL output" "INQ_PART target_pid" "EDIT_PART PARENT" "LET output (INQ number_code)" "LET output (DOCU_CSTRING_TO_LSTRING output)" "(DOCU_OPEN_CONNECTION_TO_SD)" "(DOCU_ADD_LINE_TO_SD output)" "(DOCU_CLOSE_CONNECTION_TO_SD)" "END_DEFINE" ) ) Thank you in advance Ciao Michele |
#6
|
||||
|
||||
Re: Macro Annotation
@Andy .. there is a change_part available.. in newer versions.. and it's not documented AFAIK
@Michele Attached is a macro file. I recommend to use Notepad++ with the CoCreate syntax highlighting activated. This makes editing easier, because is also help checking the syntax. Another reason is that sd-execute-annotator-command is limited to send a maximum of ~1000 chars as a single string. Once you exceed that value you will get strange and funny results with your macro, because it's not complete. (if you get a result at all, because chances are high to get a hang-up in this case) You have to adjust the LISP call of the macro since I removed the 2nd parameter with the INQ number. The macro is now too special to pass through that number, I think. On the LISP side you will get back a list of string as I mentioned in my first post. Make a single string out of it as I showed earlier. remark: the macro is only written. I did not test it. I think you will get it to work. Let us know.
__________________
Last edited by Wolfgang; 06-18-2010 at 11:44 AM. Reason: include image in text |
#7
|
|||
|
|||
Re: Macro Annotation
Hi!
Thank you for your help. But the macro doesn'nt work.... I changhe the macro in the while like this Code:
WHILE (INDICE < 3) (DOCU_ADD_LINE_TO_SD CSTRING_TO_LSTRING work_pname)) EDIT_PART PARENT INQ_PART . LET work_pname (INQ 301) LET INDICE (INDICE + 1) END_WHILE And the macro return the list of name of the same part... For example: (part part) and not (group part)... Thanks in advance Ciao Michele |
#8
|
||||
|
||||
Re: Macro Annotation
sh.. happens
remove Code:
INQ_PART . Code:
INQ_PART '.' Code:
INQ_PART CURRENT Code:
... trace del_old 'c:/temp/my_macro.log' while.... end_while trace off ... On the LISP side you need a (reverse ..) in addition PHP Code:
__________________
|
#9
|
|||
|
|||
Re: Macro Annotation
Hi, Wolfang....
Unfortanely the macro doens't work!!! I try and the macro return: (name_of_part 1 name_of_drawing) I attach the logfile and you can see the "parte1" is the correct name of part, "1" I don't know and "gruppo15" is the name of Annotation's drawing... To stop the loop i use an index.... to do only 4 loop. Another question, but I see one ) more in your code: Code:
(DOCU_ADD_LINE_TO_SD CSTRING_TO_LSTRING work_pname)) Thanks in advance Ciao Michele |
#10
|
|||
|
|||
Re: Macro Annotation
Sorry the log file!!!!
Michele |
#11
|
|||
|
|||
Re: Macro Annotation
Hi,
I understand what it is Quote:
But the three in Me10 of sheet is in attached photo. Ciao Michele |
#12
|
|||
|
|||
Re: Macro Annotation
I have found the solution...
This macro accept in input the point of geometry and return the list with the name of part group name of view... Ciao Michele |
#13
|
|||
|
|||
Re: Macro Annotation
Hy!
Now I have a new problem. I create the refline with the attached macro. But when I update the view the refline disappear. What happen? Ciao Michele |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|