MoI discussion forum
MoI discussion forum

Full Version: DXF related question

Show messages: All  1  2-14

From: keith1961
27 Nov 2017   [#2] In reply to [#1]
Hi Paul
You can hold down the left mouse button and drag to select multiple anything. Whether you drag right or left alters the selection. I have no idea about the DXF question.
BW
Keith
From: pw
27 Nov 2017   [#3] In reply to [#2]
Hi Keith,
do you mean the rectangle selection?
If so, that is not easy, if you have long segmented lines lines, for example the outline of a fuselage, you want to join, because there are a lot of objects inside, you automatically select too.

In Autosketch there a simple solution. When you want to join all adjacent objects it a segment (only 2d and of course directly linked), you click on that object, holding the ctrl-button, and you have a joined object. That is very easy an straight forward.

Best Regards,
Paul
From: Michael Gibson
27 Nov 2017   [#4] In reply to [#1]
Hi Paul, welcome to the forum!

re: select adjacent 2D curves - right now I'm not aware of any existing script to do that. That's probably something that I'd want to add into the main MoI program instead of in a script since it would need to look through the entire model which could possibly be slow on complex models.

re: DXF layers, MoI does support writing styles as layers for DXF export, but currently not for DXF import. That's something I can tune up in v4.

- Michael
From: pw
27 Nov 2017   [#5] In reply to [#4]
Hi Michael,
thank you for the fast response.

That are good news. I am looking forward to.

Please keep also an eye on the sequence (2D-Objects), if it touches MOI's internal object architecture not to hard. Resequencing everything every time and not only the new added parts is also troublesome. The objects names with added number (xx_1) could be a possibility in case.

Best Regards,
Paul
From: Michael Gibson
27 Nov 2017   [#6] In reply to [#5]
Hi Paul, do you have a simple example that you could post so I could test the sequence problem here?

I'm not sure if I'll be able to guarantee the same order sequence of entities in the file but I'd need to be able to reproduce the problem over here first to know if it's possible or not.

- Michael
From: pw
27 Nov 2017   [#7] In reply to [#6]
Well, easily construct 4 polylines from left to right.

When I import them, they are correctly in a row:



When I modify object 3 in MOI, export again then the sequence is the following:



(dotted lines are the moves between the objects)


May be the sequence of exporting in MOI is affected by the modifying of the objects.

Best Regards,
Paul

Image Attachments:
s1.jpg  s2.jpg 


From: Michael Gibson
27 Nov 2017   [#8] In reply to [#7]
Hi Paul, yes modifying objects will definitely modify their sequence. I'm sorry but that's not likely to be something that I will be able to change because the general approach for modifying an object in MoI is that it is equivalent to deleting the object and making a brand new one. Also there's not always a one-to-one relationship, several commands such as booleans can combine multiple objects into a single object.

- Michael
From: Michael Gibson
27 Nov 2017   [#9] In reply to [#1]
Hi Paul, ok now I understand what you were getting at with the object names. Yes it should be possible to assign numeric object names when you open a .dxf file and then sort them by name before doing the export. I'll try to cook up some scripts that do that later tonight.

- Michael
From: pw
30 Nov 2017   [#10] In reply to [#9]
Hi Michael,
sorry to disturb you again.
You indicated a possible solution with scripts. I im not quite familiar with javascript and of course also not in detail with moi interfaces, nevertheless I tried to get a little bit deeper into that problem myself.

Meanwhile I did the following:

- I just bought a licence of moi (from our german reseller, I shifted my new radio to the next year, hopefully the update fee to V4 ist not to high :) ).
So I can get use of the next V4 betas. Hopefully you find the time to implement DXF-Layer to MoI-Style import.

- I programmed a script, which, sets Objects names:
---
script: /* DXF input rename objects V1*/
var Objects = moi.geometryDatabase.getObjects();

for ( var i = 0; i < Objects.length; ++i ) {
//{ Objects.item(i).name = 'obj_' + ((i+1)*10); }
{ Objects.item(i).name = (i+1)*10; }
}
moi.ui.alert( 'Rename objects V1\nDone: rename!\n' )
---
This works, although I tried to establish names like pl_10, cl_20 (polyline, circle ...) and so on for curve-objects. But I think, there is no interface for that?
By the way: MOI's visible objects are sorted in an alphabetical order, aren't they? Is there a way to show them in a order of the ObjectList (from GeometryDatabase.getObjects())?

- Then I programmed two scripts to go through the objectlist cw and ccw (attached) (shown by single selected objects).
This also works, probably there is a better way, then looping.

- Than I tried a manual sorting:
---
var Objects=moi.geometryDatabase.getObjects();
Objects.sortBySelectionOrder();
---
That doesn't work, I don't know, why. I can't see any effect?

-At last I tried a sorting back of the (disordered) objects. That also doesn't work:
---
script: /* reorder object V1*/
//moi.ui.alert( 'testest' );
var Objects=moi.geometryDatabase.getObjects();

Objects.sort(function(a, b){

return Number(a.item.name) - Number(b.item.name)
});
---
That script fails, and I don't know, if I could do that generally in such a short way (although it would be elegant). Maybe Objects (it should be a list) is not a sortable javascript array.
I am sure, you can give me a hint for this solution quickly.

Thank You in advance,
Paul

Attachments:
_pw_select_last.js
_pw_select_next.js


From: Michael Gibson
30 Nov 2017   [#11] In reply to [#10]
Hi Paul, sorry I've been so focused on tracking down some bugs for the V4 beta that I forgot to do those scripts for you.

So possibly the easiest way to do these is to modify the regular File > Open and File > SaveAs commands, that way you won't need to remember to run the scripts separately every time.

Please try replacing the regular Open.js and SaveAs.js files in your commands directory with the attached versions. Let me know if that does not do what you needed.

- Michael

Attachments:
Open.js
SaveAs.js


From: Michael Gibson
30 Nov 2017   [#12] In reply to [#10]
Hi Paul,

re:
> By the way: MOI's visible objects are sorted in an alphabetical order, aren't they? Is there a way to
> show them in a order of the ObjectList (from GeometryDatabase.getObjects())?

The list of objects in the Scene Browser are sorted in alphabetical order but that's something that the Scene Browser does on its own, the actual raw list from the geometry database is not in any sorted order other than newly created objects will be at the end.

- Michael
From: pw
4 Dec 2017   [#13] In reply to [#12]
Hi Michael,

I tested your solution with the DXF-export and after inserting the line
"objects = moi.geometryDatabase.getObjects();"
in your script after writing back from the helperarray it work's perfectly for me. It seems, that otherwise the unsorted array is written. Thank you very much for your help. No problem with the late response, it was anyway better for my learning curve to try things first and see your solution afterwards.

I have a wish and two questions.

- If you implement the DXF-layer to MoI-Styles feature, could you do this not only for the V4 but, if there will be a maintainace release in the future, also for the V3? The reason is, I use Linuxcnc form my mill, witch is the common Linux distro with realtime patches. Until now it is still 32bit, and the MiO V4 on Wine won't work there.

- If I have wishes/suggestions for the V4 (for example an autoupdate and autoscroll for the logging window for easier debugging?), where should I place them, in the forum and/or on the Wiki-pages?

- The same, I found some little thing, testing the V4, for example, when you click SaveAs, firstly the Open-Dialog appears, and after canceling that, the SaveAs Dialog (I assume you know that already), or the OSnap Info is not shown like in V3, when you approach an OSnap-point or a crash of the V4 after several hibernation-cycles. Are you interested in those reports, and if so, where should I place them?

Best Regards,
Paul

Attachments:
SaveAs.js


From: Michael Gibson
4 Dec 2017   [#14] In reply to [#13]
Hi Paul, that's great I'm glad that's working for you!

> - If you implement the DXF-layer to MoI-Styles feature, could you do this not only for
> the V4 but, if there will be a maintainace release in the future, also for the V3?

I'm sorry but I'm not doing any more work on V3 except for absolutely critical fixes.


> If I have wishes/suggestions for the V4 (for example an autoupdate and autoscroll for
> the logging window for easier debugging?), where should I place them, in the forum
> and/or on the Wiki-pages?

Here in the forum would be great. For improved logging it's probably more likely that I'd try to add support for some of the system logging tools like OutputDebugString on Windows, that way you'd be able to use some other existing tool to see a live logging stream rather than me spending time on that.


> The same, I found some little thing, testing the V4, for example, when you click SaveAs, firstly the
> Open-Dialog appears, and after canceling that, the SaveAs Dialog (I assume you know that already),

That looks like a bug in the customized SaveAs.js replacement - at the top where it uses getOpenFileName(); change it to getSaveFileName();


> or the OSnap Info is not shown like in V3, when you approach an OSnap-point

Yes I know about this one - the display of text inside of viewports is one of the few remaining areas that have not been implemented quite yet in V4.


> or a crash of the V4 after several hibernation-cycles. Are you interested in those reports, and if so, where should I place them?

If some crash report files were generated, like moi_report1.zip, moi_report2.zip , etc... can you please e-mail those to me at moi@moi3d.com so I can take a look?

Thanks, - Michael

Show messages: All  1  2-14