MoI discussion forum
MoI discussion forum

Full Version: V5 beta May-22-2022 available now

Show messages:  1-5  6-25  26-45  46-65  66-85  86-105  106-125  126-145

From: bemfarmer
24 Jun 2022   [#66]
Should be from CustomUI.2.0.beta2. (???) 2/11/2018

I think I should have used
code:
  ,  
in my prior post.
Messed up the forum post... Now I cannot edit it...
Maybe you can fix my post... Or just delete it...

- Brian
From: bemfarmer
24 Jun 2022   [#67] In reply to [#66]
Second try:

code:
  var title = "Snapshot";
var command = "snapshot(1600,1200, event.button, event.shiftKey, event.ctrlKey)";
var icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAAHdbkFIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABdxJREFUeNpi/P//PwM+wMRACJBrwn9cCjih9FmirWDB5R5GRkYITcgEgABipDwcsHmNFJBFKKD+MqEJSkNpRoxwAPoGJsiIFA7MBL0JEEAEFRACLMjBjgb+gnwJDUuQgmnkpKc9BMJ3MS4DcoC4FYv4dPR4wOeCdWh8SyyuScWXVgLR+NHI8QcFrOBYAAYiuVERQXE0AgQQxQYwMVAIKDaAEY9cLxDfgabImQTUUpbj/xPQ9ByP/BIWPBoZiXD2ESY8YaNCjCuZcNjODA1AQoH9H5cL/hIZsP+Y8EQturPvYlPLRGQauQjEyljUMLMQWULp4yr6GCmpFsBmDnhuBAggil0w4MXBkHcAA4lR8I/aDRVYPngJxE1AfBBqCRPUIFi58AuIbxIZYrCsoQTEHGhZhQlqPj8QHwPLQUOAFFf/x1HrK5FoThoIM5FoMcyHX6B8WSDmA+Kr0BAipWAAhzBywwBf4X8XqSzDp9YCiE8QoQ4WAkTnAiUoLUDAUJDlr6Hsz0SkP2YWIh0gDaU/EPAZshwnMQmW2BB4BqXfIFnADsSvgPgrEPsipQ9QVE0CNfwImAmqNP8QmwbQwV4gdgLid0D8DYhliGgnoYNU5IJoICqE06BcNFoZDbgDAAJoNApGHTDqAHK6jaBsk4nUWvoL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EoPkVpRD8y0Bd8AvqYJDnNyM1bjII6JNngEyFw9RfhprjQUW3/cWWAmjZEfJF44NGeuKB2BiIFaFNZtDi4y1AvA2IXWk9EIStTmRmoB8AdUfbB7A7jNL2ga3eRQ4Z0DqjW9Ck9w+pcENeb8SA1lZHFmNEU4e8NQib2H8cVdR/NPOwqfvHgLn1CFtf4h9UbDq0JQhawnAePj2JNpMLWuGvCc0j5HiMCYs6UsRg+ZMRR6CQYwesQL6MPiQ2OjXGMMLBaACMBsAIBwAv62NJ/N1rTwAAAABJRU5ErkJggg==";

function snapshot(w, h, button, shiftkey,  ctrlkey)
{
	function ftime()
	{
		var d = new Date(), a=d.getDate(), o=d.getMonth()+1, y=d.getYear(), h=d.getHours(), m=d.getMinutes(), s=d.getSeconds();
		a=(a>9)?a:'0'+a; o=(o>9)?o:'0'+o; y=(y>999)?y:1900+y; h=(h>9)?h:'0'+h; m=(m>9)?m:'0'+m; s=(s>9)?s:'0'+s;
		return y+'.'+o+'.'+a+'-'+h+'.'+m+'.'+s;
	}
	var getDir = moi.filesystem.getAppDataDir;
	var st = [], settings  = ["view.meshAngle", "view.viewportBackgroundColor", "view.lineWidth", "grid.display", "grid.accentedLineColor", "grid.lineColor", "grid.showXYAxes", "view.showAxisIcon",  "view.showViewTitles"];
	var time = ftime();
	var vp = moi.ui.getLastClickedViewport();
	if (!vp) { vp = moi.ui.mainWindow.viewpanel.getViewport('3D'); }
	for (var sv in settings) { st.push(moi[settings[sv].split('.')[0]][settings[sv].split('.')[1]] ); } 
	moi.view.showViewTitles = false;
	moi.view.showAxisIcon = false;
	moi.grid.showXYAxes = false;
	moi.view.viewportBackgroundColor = 0xEEEEEE;
	if ( moi.view.meshAngle > 10 )  { moi.view.meshAngle = 10; }
	moi.grid.display = (button === 2 )?false:true;
	var m = (ctrlkey)?1.5:1;
	if ( !shiftkey ) { moi.grid.accentedLineColor = 0xBBBBBB;  moi.view.lineWidth = 1;  }  else {  w = w*m*2; h = h*m*2; moi.grid.accentedLineColor = 0x999999; moi.view.lineWidth = 2; }
	
	moi.grid.lineColor = moi.grid.accentedLineColor;
	vp.render(w, h).save(getDir()+"snapshots\\"+time+"-["+vp.name+"].png");
	for (var sv in settings) { moi[settings[sv].split('.')[0]][settings[sv].split('.')[1]] = st.shift(); }
}

var script, doc = moi.ui.getUIPanel("moi://ui/CommandBar.htm").document;
var head = doc.getElementsByTagName('head')[0];

for (var i in this) if (this.hasOwnProperty(i) && this[i] instanceof Function )
{
	script = doc.createElement('script');
	script.type = 'text/javascript';
	script.innerHTML = this[i].toString();
	head.appendChild(script);
}

moi.ui.commandBar.CommandBarCustomUI.insertAdjacentHTML( "beforeEnd", '<moi:Spacer/><moi:Spacer/><moi:CommandButton icon="'+icon+'" onbuttonclick="'+command+'">'+title+'</moi:CommandButton>');   

From: Michael Gibson
24 Jun 2022   [#68] In reply to [#66]
Hi Brian, that's fine I can see the stuff I need in there thanks!

So I think the easiest fix will be that for these colors that can be set to "Custom" or "From theme", MoI won't write out the custom color value to moi.ini at program exit if the mode is set to "From theme".

I'll set it up for the next v5 beta like that.

Thanks for reporting the problem and figuring out what was the cause!

- Michael
From: bemfarmer
24 Jun 2022   [#69] In reply to [#68]
Seems like a cool solution.
So it was to do with Custom colors after all... :-)
- Brian
From: Michael Gibson
24 Jun 2022   [#70] In reply to [#69]
Hi Brian,

re:
> So it was to do with Custom colors after all... :-)

Yup, just kind of behind the scenes from the snapshot script setting the colors.

- Michael
From: Larry Fahnoe (FAHNOE)
22 Jul 2022   [#71]
Hi Michael,

I'm noticing that the Distribute script is not working properly with groups. I have several groups that I'm seeking to distribute, but Distribute seems to explode the groups into their component parts and then distribute them which makes a bit of a mess. Is it that scripts like Distribute are going to need some additional tweaking to properly work with groups, or is it exposing something with the grouping mechanism itself?

I've manually solved my problem but I've attached it as an example. There are 7 Post-Truss groups that need to be distributed on the Y axis. I realized I messed up and needed to add another post/truss, so I copied one of the existing and the used Distribute to achieve the correct result.

btw, the groups are just a delight to work with for things like this because it makes selecting a bunch of components so convenient.

Also, this is a fairly simple model that I created with v5 beta...not sure what's causing it to be 12.7M, thus the compression.

--Larry
From: Michael Gibson
22 Jul 2022   [#72] In reply to [#71]
Hi Larry, thanks for the bug report and example file.

re:
> Is it that scripts like Distribute are going to need some additional tweaking to properly work
> with groups, or is it exposing something with the grouping mechanism itself?

Some scripts may need slight tweaks to work well with groups, particularly scripts involving object transforms may need a slight adjustment.

So the deal is that to maximize compatibility with existing scripts that predate groups, the routines that return the selected objects now return not only the selected groups but also the child objects of the groups in the same list.

That makes functions like Extrude for example that are looking for profile curves automatically find curves inside of groups without needing to be modified to look through groups.

However it's not good for things that do transforms, those will generally want to transform the group itself only and not try to deal with the group children individually.

There is a new helper function that will screen out the children of a group if the parent group itself is also in an object list, and some scripts that do transforms may need to call that now.

I've updated the Distribute plug-in to do that and so if you get the updated one from here it should work ok on groups now:
http://moi3d.com/forum/index.php?webtag=MOI&msg=8503.13


> Also, this is a fairly simple model that I created with v5 beta...not sure what's causing
> it to be 12.7M, thus the compression.

There are 2051 hidden objects in the file, I think that's where most of the size is coming from.


Thanks, - Michael
From: Larry Fahnoe (FAHNOE)
22 Jul 2022   [#73] In reply to [#72]
Hi Michael,

The updated Distribute script works well with v5 beta to distribute these truss groups, thanks!

With v4 on the same model it behaves as one would expect due to not seeing the groups: just distributes all the components individually. The outer conditional is a neat way to check for a method:
code:
 	if ( objects.excludeGroupChildrenInPlace )
 		objects.excludeGroupChildrenInPlace();

--Larry
From: Larry Fahnoe (FAHNOE)
23 Jul 2022   [#74] In reply to [#73]
Hi Michael,

Since you've just been working on Distribute, I wonder you could have it distribute along CPlane axes if a CPlane has been set? As it is, when I set a CPlane and then Distribute, the objects look like they're being distributed on world axes.

I know, talk about looking a "gift horse" in the mouth... ;-}

--Larry
From: Larry Fahnoe (FAHNOE)
24 Jul 2022   [#75]
Hi Michael,

I’m working on editing objects within groups. The means of manipulating group membership is almost too subtle (simple) but is beautifully consistent with how styles work. I was looking for UI commands to add/edit group membership but now I see the light. Neat feature!

I’m seeing something else however that is probably not intended.

code:
Group hierarchy:
    Framing
        Girts
        Posts
        Purlins
        Stringers
        Trusses
            Truss1
            Truss2
            […]


At the outset all groups other than Trusses within Framing are hidden via clicking the eye in the object browser.

When I manipulate a Truss* group (like adding an object), a byproduct is that the Framing group is all unhidden AND selected. This is startling (surprising) as I would have expected the hidden/exposed state to remain unchanged and not have the top level group wind up being selected.

Edited to add:

I should also note that the BatchRename script https://moi3d.com/forum/index.php?webtag=MOI&msg=10416.2 works perfectly to tidy up lots of group names, thanks as always!!

--Larry
From: Michael Gibson
24 Jul 2022   [#76] In reply to [#75]
Hi Larry, over here I can't reproduce the problem of a group getting selected after adding an object to it.

For example with these steps:

Draw 4 circles
Select 3 circles and group them
Select the last circle and click on the group name to add it to the group

I don't end up with the group selected at the end of that.

Can you please describe what steps you were doing to end up with a selected group?

The hidden properties being lost I know about, it's on my list to look at.

Thanks, - Michael
From: Larry Fahnoe (FAHNOE)
24 Jul 2022   [#77] In reply to [#76]
Hi Michael,

I followed your example steps:

> Draw 4 circles
> Select 3 circles and group them
> Select the last circle and click on the group name to add it to the group

and they work for me as they do for you. Thinking that it might have to do with nested groups, I named the first group Circles and then nested that within Shapes. I drew a 5th circle and added it to Circles and it behaved as you intend.

Must be user error because I went back to the original model (I'd worked on other models since I posted) and am unable to reproduce the behavior of modifying one of the Trusses and winding up with the Framing group selected.

For what it's worth, I had a series of trusses that needed to have longer tails, so I had deleted the top two members of all the trusses, then I redrew a pair of the correct length. I then copied the pair into the correct positions for all the trusses, and finally added each pair to the appropriate truss group. Each time I added the pair to the group, the Framing group was unhidden and selected. Once I'd fixed all the trusses, I used BatchRename on them and then saved the file. I have attached the model in case it contains any clues.

--Larry
From: Michael Gibson
24 Jul 2022   [#78] In reply to [#77]
Thanks Larry, please let me know if you run into it again.

Is this going to be your own shed that you're constructing?

- Michael
From: Larry Fahnoe (FAHNOE)
24 Jul 2022   [#79] In reply to [#78]
Hi Michael,

> Is this going to be your own shed that you're constructing?

Actually it's all built, we recently purchased it. I did the model both because I enjoy modeling with MoI and because I wanted to plan out a bunch of pallet racking for the periphery. The model will continue to evolve as our use of the space changes.

--Larry
From: Michael Gibson
24 Jul 2022   [#80] In reply to [#74]
Hi Larry,

re:
> Since you've just been working on Distribute, I wonder you could have it distribute along
> CPlane axes if a CPlane has been set? As it is, when I set a CPlane and then Distribute,
> the objects look like they're being distributed on world axes.

I put another another update for Distribute, it should now work using x/y/z axes of the CPlane if one has been set:
http://moi3d.com/forum/index.php?webtag=MOI&msg=8503.13

- Michael
From: Larry Fahnoe (FAHNOE)
25 Jul 2022   [#81] In reply to [#80]
Hi Michael,

Thanks, I was puzzling over how to modify Distribute to use the CPlane & appreciate seeing your approach to the problem.

Now the bug report which I think may be touching on the extra items being selected.

Using the Shed model, here are the steps that I took:
1. Hide everything but the Purlins and Trusses groups
2. Select Purlin1* and delete them (probably unnecessary, but gets rid of the purlins on the right hand side of the roof)
3. Select Purlin05 and delete it (to create an uneven distribution for Distribute to work on)
4. Select Purlin0*
5. Distribute along X (without a CPlane this will produce inappropriate results, but it is the step I took)
6. Observe the result don't click DONE

Purlin01 and Purlin09 are showing selected in the object browser
Parts of all the purlins appear to be selected in the 3D view
No apparent duplication of groups in the object browser, but the 3D view makes me think that there may be duplication

7. Click DONE

What I get is very odd. There are now 6 instances of the Framing group in the object browser (oh my!). Within each instance of Framing a different purlin is selected for a total of 6 purlins selected.


Revert to the saved model.

1. Hide everything but the Purlins and Trusses groups
2. Select Purlin1* and delete them
3. Select Purlin05 and delete it
4. Using the Front view, create a CPlane with origin in the lower left corner of Purlin01.
5. Adjust Z toward you and X along the top of the truss member (base of the purlins)
6. Switch to the Top view
7. Select Purlin0*
8. Distribute along X
9. Click DONE

Essentially similar strange duplication and selection behavior as without the CPlane. This is definitely repeatable.

Certainly wasn't trying to make work for you, but perhaps my shed model is a torture test of sorts for groups and Distribute.

--Larry
From: Michael Gibson
25 Jul 2022   [#82] In reply to [#81]
Hi Larry, thanks for the additional bug report.

So your original bug report was this:
quote:

When I manipulate a Truss* group (like adding an object), a byproduct is that the Framing group is all unhidden AND selected. This is startling (surprising) as I would have expected the hidden/exposed state to remain unchanged and not have the top level group wind up being selected.


If I understand your new steps correctly there isn't any step involved for adding an object as was described in the original bug report, your steps are about running distribute on objects that are sub objects contained within another group, is that correct?

So that's a different bug than adding an object.

I can definitely reproduce that there is a bug in using Distribute on objects that are contained within a group (unlike running them on top level groups as was previously fixed). It unfortunately may be a difficult problem for a script to solve though, because when an object that is contained within a group is modified it means the top level group object gets reconstructed. So when the distribute script tries to modify several objects in a loop that are contained within the same top level group structure, when the second object is processed it is going to try and rebuild the original parent group, not the new one that is the result of the previous processed object.

This is solved for built in transform commands because they do some additional processing on a whole batch of transformed objects at once and know how to deal with groups.

I'll have to think some about whether it will be feasible to deal with this automatically or whether it will need a new API to be used by scripts that transform objects to submit them in one batch. Either way will require changes in the back end processing and so won't be fixed by just editing the script itself.

- Michael
From: Larry Fahnoe (FAHNOE)
25 Jul 2022   [#83] In reply to [#82]
Hi Michael,

> If I understand your new steps correctly there isn't any step involved for adding an object as was described in the original bug report, your steps are about running distribute on objects that are sub objects contained within another group, is that correct?

> So that's a different bug than adding an object.

Yes & yes.

I was unable to reproduce the behavior and record the steps to do so for the first issue (which may have been my error). You are correct, this issue is caused by different actions. When I saw more odd behavior, I documented it & thought that it might be related.

Thanks for the explanation of the new issue, it paints more of the picture and makes sense to me. Since much of MoI is opaque to me it is somewhat difficult to know if odd behavior is an indication of a bug that you'll want to address or a smaller issue limited to a few scripts. I appreciate being able to raise either one of them AND your good feedback about what's going on. Problem is that so much of MoI is just so polished, even in betas, that it is quite a surprise when odd behavior rears its head!

> when an object that is contained within a group is modified it means the top level group object gets reconstructed. [...]

That's something that is probably not obvious to most users (& probably needn't be) but it is a good insight for scripts that loop over a list of groups.

I typically use styles to segment the components of my models and have been experimenting with using groups for this purpose. Maybe some of this segmentation is more appropriate for the folder concept you have also mentioned thinking about.

--Larry
From: Hugh McMaster (HMC)
27 Jul 2022   [#84]
Hi there, do you have a roadmap for the final v5 release?
From: Michael Gibson
27 Jul 2022   [#85] In reply to [#84]
Hi Hugh,

re:
> Hi there, do you have a roadmap for the final v5 release?

Sorry no not really. But it will likely be around 3 or 4 more beta releases and then I'll wrap it up.

- Michael

Show messages:  1-5  6-25  26-45  46-65  66-85  86-105  106-125  126-145