From: pw
Hello,
I am new to this forum. Form time to time I came back an see MOI evolving. I am now highly impressed of it's capabilities. Being a hobbyist (rc-modeller) I have not yet a licence (but it is on my wishlist :)) but now had a deeper look into the trial version.
I have two questions:
- Is there a possibility / script, that selects all adjacent 2d-curve objects to a selected object (only one object is initially selected). I often have the task, for example at wing sections, that there are a lot of adjacent lines, which are quit troublesome to select before joining.
- I have an old homebuilt program to make G-Code from DXF (R12) files. To code my tool properties, tabs and so on, I use the DXF-layer names (pretty like DXF2Gcode). So I can import the DXF files into my old Autosketch, modify them, an have this information preserved at export time. Also the sequence of the imported objects (all simple 2d) are preserved. MOI doesn't know layers and so unfortunately I loose all of this information (everything has the DXF-Layer name "Standard") and also the sequence of the objects seems to be distorted.
Is there a way (script?, option), which for example sets the objects dxf layer name to the MOI's style name of this object at import and also vice versa at the export to dxf. To keep the sequence, a possible solution could be to name the imported object to something like "part_1", "part_2" and so on (and export them in this way again), if it is to complicated to do this implicitly.
Thank You in advance for your help.
Paul
From: keith1961
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
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
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
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
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
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
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
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
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
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
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
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
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)
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)
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
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