MoI discussion forum
MoI discussion forum

Full Version: DXF related question

Show messages: All  1-9  10-17

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
From: Mindset (IGNITER)
21 Nov   [#15] In reply to [#14]
Howdy Y'all,

Don't know if this is the right thread for my issue, but I used this script to rename some open curves sequentially:
http://moi3d.com/forum/index.php?webtag=MOI&msg=3114.23

Exported them to DXF for use in Blender, but there they all imported as one object.
Is there a better way to accomplish my goal?
I'd rather not have each on a separate layer.

Thanks.,
MindSet
From: Mindset (IGNITER)
21 Nov   [#16] In reply to [#15]
Well... a bit of progress to report:

Discovered a setting in the Blender DXF import dialog-box that allows for the avoidance of item merging.


Of course it does not provide the same sequence value as the original, but at least I can use it❗

Please, let me know if there is a better fix.
I couldn't find information on the other merge options, so I left them at their default.

Image Attachments:
Blender DXF Import.jpg 


From: Michael Gibson
21 Nov   [#17] In reply to [#15]
Hi MindSet, object names do not get written to DXF format because as far as I know there isn't a concept of an object name there.

The main thing that has name labels in DXF is layers, and the style names in MOI should be preserved in the layers list in the generated DXF file.

If you have any DXF files that do import into Blender with object names coming through please send them to me so I can see how they are set up.

- Michael

Show messages: All  1-9  10-17