auto naming function
All  1-6  7-13

Previous
Next
 From:  noskule
5701.7 In reply to 5701.5 
hi michael, thanks for the script. Could the script be modified so that it takes the name of an already selected object and ask me to select the object which should get the striped name? So the workflow would be as follows (taking the sweep example):


Profile and rail are named Pipe.CE

I perform the sweep, the pipe object will be created and the profile and rail are still selected

I call the strip-ending command and the script takes the name of the selected element, strips the ending and ask me to choose the element which should get the name

I choose the pipe.


This way I only have to perform one action, if the script only strips the ending I still have to name it manualy ore use another script to apply the name of the construction elements first.
~nos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5701.8 In reply to 5701.7 
Hi Nos, that's getting pretty complicated to also incorporate object picking into a kind of one-line shortcut key script like that.

For something that involves object picking it would probably need to be redone as a plug-in command instead of as a direct shortcut key script.

Is the object that you would pick for receiving the name always the one that was created by the last run command?

Because if that's the case I think it should be possible for the script to find that object automatically and so not have any separate object picking stage needed.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  noskule
5701.9 In reply to 5701.8 
Yes its always the last object. So if the script would find the object automatically its even better. So I only could perform a construction command, press the shortcut and the newly created object gets the name of the construction elements striped from the ending.
~nos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  noskule
5701.10 In reply to 5701.6 
hi Michael
I tried the scripts and as you mentioned they working as long a the history is intact. Is there a reason for using the history instead of searching for the names? Cause searching for names with/without the ".CE" Ending would work interdependently form an intact history.
~nos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5701.11 In reply to 5701.10 
Hi nos,

> Is there a reason for using the history instead of searching for the names?

Because history is the only built in mechanism that matched what you were asking for.

Could you describe in a bit more detail exactly what names would be targeted? I guess I need more details about what you need these scripts to do - the brief descriptions you gave before did not give me enough information to do what I guess you need.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
5701.12 In reply to 5701.9 
Hi nos,

> Yes its always the last object. So if the script would find the object automatically its even better.
> So I only could perform a construction command, press the shortcut and the newly created object
> gets the name of the construction elements striped from the ending.

Give this one a try:

script: /* Apply selected object name to last generated object */ var name = ''; var gd = moi.geometryDatabase; var objs = gd.getSelectedObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); var thisname = obj.name; if ( thisname.length > 3 && thisname.charAt(thisname.length-3) == '.' ) { name = thisname.substr( 0, thisname.length-3 ); break; } } if ( name != '' ) { gd.selectLastCreated( true ); gd.getSelectedObjects().setProperty( 'name', name ); }


This way this should work is say you a profile and a path curve both named Pipe.CE. Then you create a sweep from these curves - now with those curves selected, run this script and that should then make the sweep have the name Pipe, it will just look for a name in the current selection with a period and any 2 letters after it and if it finds that it will name the last generated object to be that name with the last 3 letters stripped off.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  noskule
5701.13 In reply to 5701.12 
Hi Michael, thanks ver y much, this works perferctly.
~nos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-6  7-13