Thread: Add elemt info
View Single Post
  #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