CoCreate User Forum  

Go Back   CoCreate User Forum > Applications > Annotation

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 12-04-2018, 06:16 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 261
Add elemt info

it is possible to associate an annotation info to a text.
With me10 the command was used.

ADD_ELEM_INFO 'TR:WTtr:PTC_WM_LIFECYCLE_STATE:2:0:1:-102:1:0' SELECT GLOBAL PICK_VP_PNT 1 -50,10 CONFIRM END

Is it possible to do it directly in annotation?
Reply With Quote
  #2  
Old 12-04-2018, 10:54 PM
Shaba's Avatar
Shaba Shaba is offline
Registered User
 
Join Date: Nov 2006
Location: Italy
Posts: 215
Re: Add elemt info

Prova questo

Code:
(OLI:SD-EXECUTE-ANNOTATOR-COMMAND :CMD \"ADD_ELEM_INFO 'TR:WTtr:PTC_WM_LIFECYCLE_STATE:2:0:1:-102:1:0' SELECT GLOBAL PICK_VP_PNT 1 -50,10 CONFIRM END\")
Anche se mi lascia perplesso che fai la selezione su un punto
E' una info da aggiungere per la compilazione del cartiglio?
Reply With Quote
  #3  
Old 12-06-2018, 07:31 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 261
Re: Add elemt info

sure that the "\" go there? gives me lisp error

in place of the coordinates "PICK_VP_PNT 1 -50,10" can I enter a variable that I calculate ??

there is an info to associate with a text already present on the cartouche completed by hand

Last edited by andrea; 12-06-2018 at 07:55 AM.
Reply With Quote
  #4  
Old 12-06-2018, 01:21 PM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Add elemt info

You are correct that the "\" causes errors in this case -- no "\" is needed.

You can certainly do this using the "ADD_ELEM_INFO ..." command, but (as you have discovered), it can be difficult to specify the object that you want to attach the info to.

Perhaps an easier way for you to do it is to use the lisp functions provided by the Annotation module. This will allow your dialog to allow the user to select an annotation item (part, line, etc) and then add the INFO to it using the command
(sd-am-add-info-attributes (list "Info 1" "Info 2" ) myobject)
or something like that. This would allow you to easily construct the info strings within your dialog and then attach them to the selected object.

Of course, if you want to use the ADD_ELEM_INFO approach, you can create that entire string using the (format ... ) command to build the string with the components you'd like, and then send that string to Annotation using the
(sd-execute-annotator-command :cmd mystring)
approach...

I hope this helps!

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!
Reply With Quote
  #5  
Old 12-06-2018, 11:37 PM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 261
Re: Add elemt info

what is the right writing to insert in :

(list "Info 1" "Info 2")
for my attribute
PTC_WM_LIFECYCLE_STATE

that I can not find the documentation for command :

sd-am-add-info-attributes
andl list "Info" !!
Reply With Quote
  #6  
Old 12-07-2018, 03:37 PM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Add elemt info

You could do something like this:
Code:
(sd-am-add-info-attributes myobj (list "TR:WTtr:PTC_WM_LIFECYCLE_STATE:2:0:1:-102:1:0"))
Note that you will need to have myobj specified in your dialog, where myobj is an Annotation object.

The documentation for sd-am-add-info-attributes (and other related functions) can be found in the help.
Select "Documentation for Advanced Users"
Select "Integration Kit"
Select "Reference Manual"
Scroll down and select "Info Attributes" (under the Annotation Module heading)
Read about the functions and how they work.

I hope this helps!

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!
Reply With Quote
  #7  
Old 12-10-2018, 05:48 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 261
Re: Add elemt info

to indicate a "myobj" the text to which I want to add the info via the coordinates 2d ??

my text here I want to add the info has these 2D coordinates (always different from one drawing to another):

(setf pnt-x (gpnt2d_x (Nth 1 (sd-am-sheet-struct-corners (sd-am-inq-sheet (sd-am-inq-curr-sheet))))))
(setf pnt-y (gpnt2d_y (Nth 0 (sd-am-sheet-struct-corners (sd-am-inq-sheet (sd-am-inq-curr-sheet))))))
Reply With Quote
  #8  
Old 12-11-2018, 08:27 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Add elemt info

Thanks for the additional information. I was thinking you needed to pick the object using the mouse -- since you can get the x and y points from the functions you listed, something like this might work:

Code:
(defun add-infos-to-sheet-text ()
  (let (pnt-x pnt-y cmdstr)
    (setf pnt-x (gpnt2d_x (Nth 1 (sd-am-sheet-struct-corners (sd-am-inq-sheet (sd-am-inq-curr-sheet))))))
    (setf pnt-y (gpnt2d_y (Nth 0 (sd-am-sheet-struct-corners (sd-am-inq-sheet (sd-am-inq-curr-sheet))))))
    (setf cmdstr (format nil "ADD_ELEM_INFO 'TR:WTtr:PTC_WM_LIFECYCLE_STATE:2:0:1:-102:1:0' select global texts (pnt_xy ~a ~a) confirm end" pnt-x pnt-y))
    (sd-execute-annotator-command :cmd cmdstr)
    )
  )
Then just call the add-infos-to-sheet function and it should work. NOTE: I haven't tested this, but the idea is correct.

Does this help?
__________________
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!
Reply With Quote
  #9  
Old 12-17-2018, 04:59 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 261
Re: Add elemt info

Don't add info at this text ....
why ???
Reply With Quote
  #10  
Old 12-17-2018, 08:44 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 754
Re: Add elemt info

Quote:
Originally Posted by andrea View Post
why ???
Figure out!

try this
Code:
(setf cmdstr (format nil "LINE (pnt_xy ~a ~a)" pnt-x pnt-y))
....as command string in Andy's function. It should start a 'rubbel line' at the start point. Is that a point with the right coordinates?

Does the Annotator exe report an error?
call (oli:sd-am-errros :clear) before your function call
call (display (oli:sd-am-errros :get_all)) after your function call
Reply With Quote
  #11  
Old 12-18-2018, 05:57 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 261
Re: Add elemt info

help me, this is the example to which I want to add my info to the text indicated in the image

This is the macro that I created, but does not add the info to the text

(defun add_infos_to_sheet_text ()
(let (pnt-x pnt-y cmdstr)
(setf pnt-x (- (gpnt2d_x (Nth 1 (sd-am-sheet-struct-corners (sd-am-inq-sheet (sd-am-inq-curr-sheet))))) 125.964))
(setf pnt-y (+ (gpnt2d_y (Nth 0 (sd-am-sheet-struct-corners (sd-am-inq-sheet (sd-am-inq-curr-sheet))))) 22.792))
(setf cmdstr (format nil "ADD_ELEM_INFO 'TR:WTtr:PTC_WM_LIFECYCLE_STATE:2:0:1:-102:1:0' select global texts (pnt_xy ~a ~a) confirm end" pnt-x pnt-y))
(oli:sd-execute-annotator-command :cmd cmdstr)
;;(DISPLAY(format nil "~a ~a" pnt-x pnt-y))
)
)
Attached Thumbnails
Click image for larger version

Name:	Cattura.JPG
Views:	438
Size:	52.5 KB
ID:	1997  
Attached Files
File Type: mi 88.mi (57.0 KB, 539 views)
Reply With Quote
  #12  
Old 01-03-2019, 10:15 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Add elemt info

Hi Andrea,

Thanks for including the drawing file and the image of the text you want to use -- both were very helpful!

It turns out that selecting texts using the SELECT method using a point (as we did) doesn't work, so we need to do something else.

It does work to pick the point directly, but it needs to be exact. I modified the function so it uses slightly different coordinates (both x and y) and use that point directly:
Code:
(defun add_infos_to_sheet_text ()
  (let (pnt-x pnt-y cmdstr)
    (setf pnt-x (- (gpnt2d_x (Nth 1 (sd-am-sheet-struct-corners (sd-am-inq-sheet (sd-am-inq-curr-sheet))))) 125.963))
    (setf pnt-y (+ (gpnt2d_y (Nth 0 (sd-am-sheet-struct-corners (sd-am-inq-sheet (sd-am-inq-curr-sheet))))) 22.7918))	
    (setf cmdstr (format nil "ADD_ELEM_INFO 'TR:WTtr:PTC_WM_LIFECYCLE_STATE:2:0:1:-102:1:0' global (pnt_xy ~a ~a) end" pnt-x pnt-y))
    (pprint (format nil "cmdstr: ~A" cmdstr))
    (oli:sd-execute-annotator-command :cmd cmdstr)
    )
  )
Please let me know how this works for you.
__________________
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!
Reply With Quote
  #13  
Old 01-11-2019, 12:19 AM
andrea andrea is offline
Registered User
 
Join Date: Sep 2003
Location: italy
Posts: 261
Re: Add elemt info

Perfect thank you very much
Reply With Quote
  #14  
Old 01-22-2019, 01:14 PM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Add elemt info

You are very welcome! Glad to help!
__________________
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!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:58 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.