Problem with offset factory for nodeeditor

Next
 From:  Karsten (KMRQUS)
8158.1 
Hello,
I try to create a node for the node editor with the offset factory, but I can't figure out what I should put in input 2?
The code isn't finished and should work for curves in a first step (breps later).
Could someone explain the orientation and position of the frame?
// offset
function offset()
{
this.addInput("Object", "objectlist");
this.addInput("Frame", "pointarray");
this.addInput("Distance", "numarray");
this.addOutput("Object", "objectlist");
this.properties = {mode: ["Long", "Long", "Short"], dist:[1],dir:["Normal","Normal","Flipped","Both"]};
}

offset.title = " offset";
offset.desc = " offset";

offset.prototype.onExecute = function ()
{
var data = this.processInOut(this.properties.mode[0], this.multiProcess,null, null, this.properties.dist, this.properties.dir);
this.properties.dist = data.inputs[2];

this.setOutputData(0, data.outputs[0]);

}

offset.prototype.multiProcess = function (obj, frame, dist, dir)
{

var out = [];
//sharp
out[0] = factory('offset', obj, dist, frame ,'sharp',true, null,false,false);
/* var ofFac = moi.command.createFactory('offset');
ofFac.setInput(0, obj);
ofFac.setInput(1, dist);
ofFac.setInput(2, frame);
ofFac.setInput(3, 'sharp');
ofFac.setInput(4, true);
ofFac.setInput(6, false);
ofFac.setInput(7, false);
out[0]=ofFac.calculate();
ofFac.cancel();*/

return out;
}

LiteGraph.registerNodeType("Construct2/ offset", offset);


Thanks in advance!
Karsten
  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:  bemfarmer
8158.2 In reply to 8158.1 
The Offset.js file seems to use commonplane and pointpicker to get the Frame...
?
- Brian
  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:  Karsten (KMRQUS)
8158.3 In reply to 8158.2 
Hello Brian,
yep! I saw it also, but what is the meaning of that :-) I didn't find other docs. Maybe I should use a workaround with a sweep factory!?
I don't know ...
Have a nice day
Karsten
  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:  Karsten (KMRQUS)
8158.4 
Hello,
problem solved - everything works fine:-)
Karsten
  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
8158.5 In reply to 8158.4 
Hi Karsten, sounds like you're all set up but just in case the inputs to the offset factory are like this:

0: FactoryInput_ObjectList, "Objects" // Objects to offset.
1: FactoryInput_Double, "Distance" // Offset distance.
2: FactoryInput_CoordinateFrame, "Offset pt" // Offset through point or which-side point for curve offset.
3: FactoryInput_String, "Corner type" // Corner type "sharp" or "round", for curve offset.
4: FactoryInput_Bool, "Trim" // True = trim curve results.
5: FactoryInput_Bool, "Flip" // True = flip solid offset side.
6: FactoryInput_Bool, "Both sides" // True = offset curves to both sides.
7: FactoryInput_Bool, "Cap ends" // True = add line segment between ends of open offset curves.
  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:  Karsten (KMRQUS)
8158.6 In reply to 8158.5 
Hello Michael.

thanks for the reply!
Important for me was this:
var pln=ofFac.getCurvePlane();
ofFac.setInput(1, dist);
ofFac.setInput(2, pln);

I've displayed the pln frame in the nodeeditor and now I know what to do, to filp the side of the offset (I don't have a pointpicker here!).

Have a nice day
Karsten
  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