CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 05-25-2004, 11:36 AM
Michel Gendron Michel Gendron is offline
Registered User
 
Join Date: Oct 2002
Location: LeMoyne, Québec, Canada
Posts: 56
Rename shared part with "basename"

I need to rename a lot of shared part and I wandering if any body got a function that can select all shared part, or a list of part, than rename them using a basename.

Thanks

Michel
__________________
Michel Gendron, ing
Reply With Quote
  #2  
Old 05-25-2004, 12:33 PM
dszostak's Avatar
dszostak dszostak is offline
Registered User
 
Join Date: Oct 2002
Location: Boston, MA
Posts: 292
With or without a macro, don't forget to use the Shared Object Browser in Designer Modeling to help you with this renaming task.
Right-click on any shared part and select Show All Shares. This will open the Shared Object Browser, which can be docked and undocked to the main Browser Bar.

See attached image.
Attached Thumbnails
Click image for larger version

Name:	sharedobjectbrowser.jpg
Views:	651
Size:	38.1 KB
ID:	290  
__________________
David@CoCreate
Reply With Quote
  #3  
Old 09-15-2007, 02:00 AM
Shaba's Avatar
Shaba Shaba is offline
Registered User
 
Join Date: Nov 2006
Location: Italy
Posts: 215
Lightbulb Rename shared part with "basename"

There is a macro to rename multiple shared part?
In format part.001 Es.

test_name_part.001
test_name_part.002
test_name_part.003
....
test_name_part.099


TNX
Shaba
Reply With Quote
  #4  
Old 09-15-2007, 03:15 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: Rename shared part with "basename"

At http://osd.cad.de/lisp_3d.htm#38, you'll find some code which helps with renaming shared parts. It may not do exactly what you want, but maybe you can adapt it to your requirements.

Claus
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #5  
Old 09-15-2007, 01:43 PM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 273
Re: Rename shared part with "basename"

I don't know if this is of interest to you or not, but our AI MultiRename function (part of our AI DesignAccelerator Professional module) not only does "basename" renames, but also allows you to add prefixes and/or postfixes, as well as search-and-replace functionality. Selection options are also flexible, allowing you to select "All Shared" and "All Shared in Assembly" (in addition to using only the selected objects, of course).

You can see an example of how fast and easy it is to use the "basename" functionality by watching this video. If you would like to try it for yourself, just ask and we'll be glad to provide you with an evaluation license for any of our products.

Thanks!

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!

Last edited by Andy Poulsen; 09-15-2007 at 10:47 PM.
Reply With Quote
  #6  
Old 09-16-2007, 03:22 AM
Shaba's Avatar
Shaba Shaba is offline
Registered User
 
Join Date: Nov 2006
Location: Italy
Posts: 215
Re: Rename shared part with "basename"

Thank you very much for help!
I took http://osd.cad.de/lisp_3d.htm#38 macro and i change it to make what i need.

Now i can rename part (shared or not) by name or Doc-Info or Masterdata
or Doc-Info+masterdata or manually)

Very very great!!!

TNK again!

--
Shaba
Reply With Quote
  #7  
Old 09-17-2007, 04:56 AM
tom kirkman's Avatar
tom kirkman tom kirkman is offline
Registered User
 
Join Date: Oct 2002
Location: Perrysburg, Ohio
Posts: 397
Re: Rename shared part with "basename"

Shaba

Could you post the re-written code, or email it to me?

Thanks

Tom
Reply With Quote
  #8  
Old 09-17-2007, 05:17 AM
wathavy's Avatar
wathavy wathavy is offline
Registered User
 
Join Date: Jul 2007
Location: Japan Nagano
Posts: 537
Re: Rename shared part with "basename"

Please put it here, Shaba.
I would like to see it too. And I guess a lot of us do, too.
__________________
Toshi
Reply With Quote
  #9  
Old 09-17-2007, 12:05 PM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
Re: Rename shared part with "basename"

Two threads on same topic were merged on Sep 17. 2007.
__________________
John Scheffel
Reply With Quote
  #10  
Old 09-17-2007, 01:12 PM
Shaba's Avatar
Shaba Shaba is offline
Registered User
 
Join Date: Nov 2006
Location: Italy
Posts: 215
Re: Rename shared part with "basename"

Quote:
(in-package :custom)
(use-package :OLI)
;;--------------------------------------------------------------------------*
(sd-defdialog 'Rinomina_parti_condivise
:dialog-title "Cambia nomi Parti/Gruppi"
;;:dialog-control :sequential
:variables
'(
(csids)
(wahl
:selection
(*sd-object-seltype*)
:multiple-items t
:prompt-text "Seleziona Parti o Gruppi da rinominare"
:title "Selez. Parti/G"
:initial-value nil
)
(nur
:selection
(*sd-object-seltype*)
:multiple-items t
:show-select-menu t
:prompt-text "Lavora solo su queste Parti/Gruppi condivisi"
:title "Solo le Cond."
:initial-optional t
:after-input (after-nur-action)
)
(mnum :value-type :grouped-boolean
:title "Da Nome"
:initial-value nil
)
(mcod :value-type :grouped-boolean
:title "Da Codice"
:initial-value nil
)
(mbes :value-type :grouped-boolean
:title "Da Descriz."
:initial-value nil
)
(mcde :value-type :grouped-boolean
:title "Cod.+Desc."
:initial-value t
)
(cust :value-type :string
:title "Manuale:"
:toggle-type :indicator-toggle-data
:initial-value nil
)
(alle :value-type :boolean
:toggle-type :wide-toggle
:title "Rinomina Tutte"
:initial-value t
)
(ol :value-type :boolean
:toggle-type :wide-toggle
:title "Solo un livello"
:initial-value t
)
(next
:push-action (sd-call-cmds (next-action))
)
)
:mutual-exclusion '((mnum mcod mbes mcde cust))
:local-functions
'(
(after-nur-action ()
(let (kind csid)
(dolist (kind nur)
(setf csid (sd-inq-obj-contents-sysid kind))
(push csid csids)
);;dolist
)
)
(next-action ()
(let ()
(dolist (kind wahl)
(dc4-mminfo-to-basename-in-bgr kind alle mnum mcod mbes mcde cust csids ol)
);;dolist
)
)
)
:ok-action
'(sd-call-cmds (next-action))
)
(defun dc4-mminfo-to-basename-in-bgr (teil_bgr alle mnum mcod mbes mcde cust csids ol)
(let (basename owner pathname mminfo basename newpath kind kinder csid)
(setf basename (sd-inq-obj-basename teil_bgr))
(setf csid (sd-inq-obj-contents-sysid teil_bgr))
(when (or (sd-inq-part-p teil_bgr)
(sd-inq-assembly-p teil_bgr)
(sd-inq-container-p teil_bgr)
)
(progn
(setf pathname (sd-inq-obj-pathname teil_bgr))
(when (sd-string/= pathname "/")
(progn
(cond
(mnum
(setf mminfo (sd-inq-obj-contents-name teil_bgr))
)
(mcod
(setf mminfo (dc4-desman-get-codice teil_bgr))
)
(mbes
(setf mminfo (dc4-desman-get-benennung-info teil_bgr))
)
(mcde
(setf mminfo (dc4-desman-get-codice-descrizione teil_bgr))
)
(cust
(setf mminfo cust)
)
(t
(setf mminfo (sd-inq-obj-contents-name teil_bgr))
)
);;if
(setf owner (sd-inq-parent-obj teil_bgr))
(when (not owner)
(setf owner (sd-pathname-to-obj "/"))
);;when
(when mminfo
(progn
(setf newname (dc4-gen-part-basename owner teil_bgr mminfo))
(when (or (and (sd-inq-part-p teil_bgr) (sd-string-match-pattern-p "[tT][0-9]*" basename))
(and (sd-inq-assembly-p teil_bgr) (sd-string-match-pattern-p "[bB][0-9]*" basename))
(and (sd-inq-container-p teil_bgr) (sd-string-match-pattern-p "[bB][hH][0-9]*" basename))
alle
)
(if csids
(progn
(when (member csid csids :test #'equal)
(progn
(if (not (sd-inq-obj-parent-contents-read-only-p teil_bgr))
(sd-call-cmds (CHANGE_NAME_PA :PART_ASMB pathname :NAME newname))
;; (display (format nil "~a La Parte/Gruppo non puo' essere rinominata" pathname))
);;if
);;progn
);;when
);;progn
(progn
(if (not (sd-inq-obj-parent-contents-read-only-p teil_bgr))
(sd-call-cmds (CHANGE_NAME_PA :PART_ASMB pathname :NAME newname))
;; (display (format nil "~a La Parte/Gruppo non puo' essere rinominata" pathname))
);;if
);;progn
);;if
);;when
);;progn
);;when
);;progn
);;when
(when (not ol)
(progn
(setf kinder (sd-inq-obj-children teil_bgr))
(dolist (kind kinder)
(dc4-mminfo-to-basename-in-bgr kind alle mnum mbes cust csids ol)
) ;; dolist
);;progn
);;when
);;progn
);;when
) ;; let
)
(defun dc4-gen-part-basename (owner teil_bgr prefix)
(let (baslist chlist ch teiletyp bas index name)
(setf baslist (list))
(setf chlist (sd-inq-obj-children owner))
(dolist (ch chlist)
(when (or (sd-inq-part-p ch) (sd-inq-assembly-p ch) (sd-inq-container-p ch))
(progn
(when (not (equal ch teil_bgr))
(progn
(setf bas (sd-inq-obj-basename ch))
(setf baslist (nconc baslist (list bas)))
);;progn
);;when
);;progn
);;when
);;dolist
(setf index 0)
(loop
(setf index (+ index 1))
(if (= index 1)
(setf name prefix)
(setf name (format nil "~a.~10,3,'0,'0r" prefix index))
);;if
(if (not (member name baslist :test #'equal)) (return t))
);;loop
(values name)
);;let
)
(defun dc4-desman-get-benennung-info (teil)
(let (attributliste attribut inf)
(setf attributliste (sd-inq-item-attributes teil :attachment :contents))
(setf inf nil)
(dolist (attribut attributliste)
(progn
(when (string= attribut "DB-PREF")
(progn
(setq inf (sd-inq-item-attribute teil attribut :DESCRIZIONE :attachment :contents))
(setf inf (sd-string-replace inf " " "_"))
(setf inf (sd-string-replace inf "=" "_"))
(setf inf (sd-string-replace inf "," "."))
(setf inf (sd-string-replace inf "X" "x"))
(setf inf (sd-string-replace inf "._" "_"))
);;progn
);;when
);;progn
);;dolist
(when (typep inf 'STRING)
(when (= (length inf) 0) (setf inf nil))
);;when
(values inf)
);;let
)
(defun dc4-desman-get-codice (teil)
(let (attributliste attribut inf)
(setf attributliste (sd-inq-item-attributes teil :attachment :contents))
(setf inf nil)
(dolist (attribut attributliste)
(progn
(when (string= attribut "DB-PREF")
(progn
(setq inf (sd-inq-item-attribute teil attribut :CODICE :attachment :contents))
);;progn
);;when
);;progn
);;dolist
(when (typep inf 'STRING)
(when (= (length inf) 0) (setf inf nil))
);;when
(values inf)
);;let
)
(defun dc4-desman-get-codice-descrizione (teil)
(let (attributliste attribut inf)
(setf attributliste (sd-inq-item-attributes teil :attachment :contents))
(setf inf nil)
(setf infcodice nil)
(dolist (attribut attributliste)
(progn
(when (string= attribut "DB-PREF")
(progn
(setq infcodice (sd-inq-item-attribute teil attribut :CODICE :attachment :contents))
(setq inf (sd-inq-item-attribute teil attribut : DESCRIZIONE :attachment :contents))
(setf inf (sd-string-replace inf " " "_"))
(setf inf (sd-string-replace inf "=" "_"))
(setf inf (sd-string-replace inf "," "."))
(setf inf (sd-string-replace inf "X" "x"))
(setf inf (sd-string-replace inf "._" "_"))
(setf inf (format nil "~a_~a" infcodice inf ))
);;progn
);;when
);;progn
);;dolist
(when (typep inf 'STRING)
(when (= (length inf) 0) (setf inf nil))
);;when
(values inf)
);;let
)
Here is
I hope you enjoy it :-)
Reply With Quote
  #11  
Old 09-23-2007, 06:51 AM
Shaba's Avatar
Shaba Shaba is offline
Registered User
 
Join Date: Nov 2006
Location: Italy
Posts: 215
Re: Rename shared part with "basename"

Quote:
Originally Posted by tom kirkman View Post
Shaba
Could you post the re-written code, or email it to me?
Quote:
Originally Posted by wathavy View Post
Please put it here, Shaba.
I would like to see it too. And I guess a lot of us do, too.
Do you have test macro?
Does it works?

--
Shaba
Reply With Quote
  #12  
Old 09-30-2007, 03:23 PM
MichaelA MichaelA is offline
Registered User
 
Join Date: Feb 2006
Location: Vancouver, WA USA
Posts: 40
Re: Rename shared part with "basename"

great examples, would be even better if I could read italian or german. Anyone know a good way to translate back and forth into English?
Reply With Quote
  #13  
Old 10-01-2007, 08:06 AM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
Re: Rename shared part with "basename"

Quote:
Originally Posted by MichaelA View Post
great examples, would be even better if I could read italian or german. Anyone know a good way to translate back and forth into English?
You can try something like the Babel Fish translator.

http://world.altavista.com/

You can copy and paste text into it and it will attempt to translate. I have used it to try to figure out some German LISP code before. It worked well enough to get some idea of what the comments said and what dialog titles meant. There are other translation sites on the web as well, but Babel Fish was one of the first. The name comes from "The Hitchhikers Guide to the Galaxy" in which there was a Babel Fish that could be placed in the ear providing translation of all languages.
__________________
John Scheffel
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 02:48 PM.



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.
You Rated this Thread: