Specific Grouping Use Case

Next
 From:  scott (SSHWARTS)
7464.1 
I know that grouping is an oft mentioned feature for a future version. I can imagine that it's no easy task to implement right. I did however want to lay out one specific use case where it would be extremely useful and maybe uncover a better way to do what I'm doing now....

Many of these designs I do have to fit with existing parts so I design with or around them so to speak. Often I'll download a part as a step file from grabcad et al, and then design my mating parts in MoI. These parts import great but are in most cases, not parts that can be joined because of flaws (I presume) in the model. I usually carefully select all the bits of the part and name them so that later I can use its name to select all of it before I move or rotate it.

So in my perfect world, I'd want to have an option on import that says, "keep together" or always work on on as a group, in effect it becomes locked together. In a case I want to modify the part I import, then fine, I'll not choose that option.

NB: I suppose as a small improvement to my process, one could have a script that asks for a name of the object upon import and assigns it in one step?

Thanks
  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
7464.2 In reply to 7464.1 
Hi Scott, thanks for describing your use case!

That may be a bit unusual approach though to have grouping done only at file import time, most common it's done by a specific "Group" command that makes a group out of selected objects.

Off the top of my head I can't really think of any examples in other programs that make groups in the way you're describing rather than with a "Group" command. Do you have any examples you can cite?


> NB: I suppose as a small improvement to my process, one could have a script that
> asks for a name of the object upon import and assigns it in one step?

If you'd like you could set up a keyboard shortcut that will pop up the "Assign name" dialog for you so you can trigger it with a keystroke rather than a click.

Some info on that here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=5738.2

- 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:  scott (SSHWARTS)
7464.3 In reply to 7464.2 
Michael:
I most certainly would relish a Group command that operates on any set of objects. I was just trying to explore if there was something I was missing in the current version that would make it easier to keep these imported objects together. I explored at one time how much work it as get all the edges joined up etc, and it became about the same amount of work as redrawing them!

I've seen in other software where upon import it automagically groups the objects (or not as an option) but it is indeed just a part of the group mechanism.

Scott
  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
7464.4 In reply to 7464.3 
Hi Scott, well the problem is the current version just does not have the low level selection infrastructure that you need to enforce keeping things together. That's something that has to be done in the core selection engine, it's not really something that can be done with a script.

When I do have a proper group mechanism my current general plan is to have a checkbox option at grouping time for "Select as one", which can be turned on or off to control whether the group will select as one unit when you click on it or not.

- 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:  scott (SSHWARTS)
7464.5 In reply to 7464.4 
Is there a script already that can be assigned to a key where if you select a named object, you can have it select all other objects of that same name? In that way, you could click on a part, and then make sure that all objects of the same name are then selected before moving.


Thanks
  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:  scott (SSHWARTS)
7464.6 In reply to 7464.5 
Actually, I guess it's easy, yes?:

var objects = moi.geometryDatabase.getSelectedObjects();
if (objects.length > 0) {
var name = objects.item(0).name;
moi.geometryDatabase.selectNamed(name);

}
  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
7464.7 In reply to 7464.6 
Hi Scott, yup that looks like it ought to do what you want!

- 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:  Philip (DUESENTRIEB)
7464.8 In reply to 7464.7 
Hi Scott,

Thanks for that script. I just tried it, but I get the following error message:



What´s wrong?

It´s the first script I try to install. Just took the script text, put it into text editor, converted to plain text, and changed the fileformat to .js . Then I put it into the commands folder and assigned a shortcut to it.

Another very useful tutorial regarding groups I found is by Max Smirnov: https://www.youtube.com/watch?v=HGiZgl2Q6g8

Asked him for the script via PM. Or does anybody know where to find it in this forum?

-Philip
Attachments:

  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:  Frenchy Pilou (PILOU)
7464.9 In reply to 7464.8 
Max Smirnov can send something to him I suppose! :)
---
Pilou
Is beautiful that please without concept!
My Gallery
  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
7464.10 In reply to 7464.8 
Hi Philip,

re:
> What´s wrong?

Can you please post your _sameName.js file here as a file attachment so I can take a look at it?

- 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:  Philip (DUESENTRIEB)
7464.11 In reply to 7464.10 
Hi Michael,

there you are. Attached the script.

-Philip
Attachments:

  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:  scott (SSHWARTS)
7464.12 In reply to 7464.11 
Philip:
I think you're missing the ending brace.

var objects = moi.geometryDatabase.getSelectedObjects();
if (objects.length > 0) {
var name = objects.item(0).name;
moi.geometryDatabase.selectNamed(name);
}

Scott
  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
7464.13 In reply to 7464.11 
Hi Philip - your script is invalid JavaScript code because it's missing the closing bracket for the if statement.

You've got an open bracket here shown in bold red:

var objects = moi.geometryDatabase.getSelectedObjects();
if (objects.length > 0) {
var name = objects.item(0).name;
moi.geometryDatabase.selectNamed(name);


So to go along with that open bracket you need a close bracket to complete the if statement, like in the attached file.

Once you add the closing bracket your script should then work as you wanted it to.

EDIT: scott beat me to it! :)

- Michael
Attachments:

  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:  Philip (DUESENTRIEB)
7464.14 In reply to 7464.13 
Thanks Scott and Michael!

Stupid small mistake. Works now.
  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