View Full Version : Rename shared part with "basename"
Michel Gendron
05-25-2004, 11:36 AM
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
dszostak
05-25-2004, 12:33 PM
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.
Shaba
09-15-2007, 02:00 AM
There is a macro to rename multiple shared part? :confused:
In format part.001 Es.
test_name_part.001
test_name_part.002
test_name_part.003
....
test_name_part.099
TNX
Shaba
clausb
09-15-2007, 03:15 AM
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
Andy Poulsen
09-15-2007, 01:43 PM
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 (http://www.asp-inno.com/multiRename_basename/multiRename_basename.html). 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
Shaba
09-16-2007, 03:22 AM
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
tom kirkman
09-17-2007, 04:56 AM
Shaba
Could you post the re-written code, or email it to me?
Thanks
Tom
wathavy
09-17-2007, 05:17 AM
Please put it here, Shaba.
I would like to see it too. And I guess a lot of us do, too.
John Scheffel
09-17-2007, 12:05 PM
Two threads on same topic were merged on Sep 17. 2007.
Shaba
09-17-2007, 01:12 PM
(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 :-)
Shaba
09-23-2007, 06:51 AM
Shaba
Could you post the re-written code, or email it to me?
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
MichaelA
09-30-2007, 03:23 PM
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?
John Scheffel
10-01-2007, 08:06 AM
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.
vBulletin® v3.8.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.