CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > ANSYS Meshing & Geometry

[DesignModeler] [DesignModeler] Pattern Function does not work,why?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Kapi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 11, 2017, 02:43
Question [DesignModeler] Pattern Function does not work,why?
  #1
New Member
 
LC
Join Date: Jun 2017
Posts: 6
Rep Power: 9
Vallence is on a distinguished road
Hi,everyone!
The following js code is a simple DesignModeler example.I want to body2 pattern around YAxis. But it does not work. How to set pattern axis?

var XYPlane = agb.GetXYPlane();
agb.SetActivePlane (XYPlane);

function planeSketchesOnly (p)
{

//Plane
p.Plane = agb.GetActivePlane();
p.Origin = p.Plane.GetOrigin();
p.XAxis = p.Plane.GetXAxis();
p.YAxis = p.Plane.GetYAxis();

//Sketch1
p.Sk1 = p.Plane.NewSketch();
p.Sk1.Name = "Sketch";

//Edges
with (p.Sk1)
{
a=10
b=20
h=20
p.Ln11 = Line(a,0,b,0);
p.Ln12 = Line(b,0,b,h);
p.Ln13 = Line(b,h,a,h);
p.Ln14 = Line(a,h,a,0);
}
edge1=p.Ln14;

//Sketch2
p.Sk2 = p.Plane.NewSketch();
p.Sk2.Name = "Sketch2";

//Edges
with (p.Sk2)
{
a=15
b=24
h=10
h0=12
p.Ln21 = Line(a,h0,b,h0);
p.Ln22 = Line(b,h0,b,h0+h);
p.Ln23 = Line(b,h0+h,a,h+h0);
p.Ln24 = Line(a,h+h0,a,h0);
}


//Dimensions and/or constraints
with (p.Plane)
{

}
p.Plane.EvalDimCons(); //Final evaluate of all dimensions and constraints in plane
return p;
} //End Plane JScript function: planeSketchesOnly

//Call Plane JScript function
var ps1 = planeSketchesOnly (new Object());

//BODY1
var MyRevolve1 = agb.Revolve(agc.Add,
ps1.Sk1,
ps1.YAxis,
agc.DirNormal,
360.0,
0.0,
agc.No,
0.0,
0.0);
agb.Regen();

//BODY2
var MyRevolve2 = agb.Revolve(agc.Frozen,
ps1.Sk2,
ps1.YAxis,
agc.DirNormal,
3.0,
0.0,
agc.No,
0.0,
0.0);
agb.Regen(); //To insure model validity


var MyPattern = ag.gui.CreatePattern();
MyPattern.Name="Pattern1";
ag.listview.ActivateItem("Pattern Type");
ag.listview.ItemValue = "Circular";

ag.listview.ActivateItem("Geometry");
agb.ClearSelections();
body1 = ag.fm.Body(1);
agb.AddSelect(agc.TypeBody, body1);
ag.listview.ItemValue = "Apply";


//==============================
ag.listview.ActivateItem("Axis");
//ag.bodyPick;
ag.edgePick; //These two methods have been tried, No Pass!
ag.gui.SelectAll();
ag.listview.ItemValue = "Apply";
//============================
ag.listview.ActivateItem("FD2, Angle");
ag.listview.ItemValue = "Evently Spaced";

ag.listview.ActivateItem("FD3, Copies (>=0)");
ag.listview.ItemValue = "8";
agb.Regen();

Last edited by Vallence; June 13, 2017 at 22:51.
Vallence is offline   Reply With Quote

Old   June 12, 2017, 20:07
Default
  #2
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hi Vallence,

Quote:
//==============================
ag.listview.ActivateItem("Axis");
//ag.bodyPick;
ag.edgePick; //These two methods have been tried, No Pass!
ag.gui.SelectAll();
ag.listview.ItemValue = "Apply";
//=======================
You shud pick either the 3D edge at center or pick "ZX Plane" rather than picking all bodies. Try to do manually so you will understand

Quote:
ag.listview.ActivateItem("FD2, Angle");
ag.listview.ItemValue = "Evently Spaced";
use "40" instead of evently spaced

Quote:
ag.listview.ActivateItem("FD3, Copies (>=0)");
try to put exactly what is in the pattern so "(FD3, Copies (>0))" will work
Kapi is offline   Reply With Quote

Old   June 13, 2017, 00:54
Default
  #3
New Member
 
LC
Join Date: Jun 2017
Posts: 6
Rep Power: 9
Vallence is on a distinguished road
Hi KAPI!
Thans for your reply. I have seen the advice you suggested, it is not the essence of the problem. What i want to do is to select XYPlane's YAxis.
Vallence is offline   Reply With Quote

Old   June 13, 2017, 01:07
Default
  #4
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
why do you have to select Y axis specifically?
if you only give reference to XY plane, it should work!
Kapi is offline   Reply With Quote

Old   June 13, 2017, 01:14
Question
  #5
New Member
 
LC
Join Date: Jun 2017
Posts: 6
Rep Power: 9
Vallence is on a distinguished road
Hi Kapi,Thank you for your prompt reply.

I tried the following code,but it deos not work.

var PatAxis=XYPlane.GetYAxis();
ag.listview.ActivateItem("Axis");
agb.AddSelect(agc.TypeEdge3d, PatAxis);
ag.listview.ItemValue ="Apply";


The key question is i do not know how to select YAxis and let it work .
Vallence is offline   Reply With Quote

Old   June 13, 2017, 19:52
Default
  #6
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
i will give it a go and let you know
Vallence likes this.
Kapi is offline   Reply With Quote

Old   June 13, 2017, 22:51
Question
  #7
New Member
 
LC
Join Date: Jun 2017
Posts: 6
Rep Power: 9
Vallence is on a distinguished road
I upload the actual result and the result I expect. You can find the difference between them.
Attached Files
File Type: pdf the actual results after running the JS Code.pdf (119.7 KB, 12 views)
Vallence is offline   Reply With Quote

Old   June 14, 2017, 00:31
Smile With the help of many friends, I solved this problem
  #8
New Member
 
LC
Join Date: Jun 2017
Posts: 6
Rep Power: 9
Vallence is on a distinguished road
Thanks very much for Kapi and EFRIVIDA's selfless help,now I solved the problem that bothered me for several days. I will publish the code for my friends Who meet the same trouble with them.
//==============================================
var XYPlane = agb.GetXYPlane();
agb.SetActivePlane (XYPlane);
function planeSketchesOnly (p)
{
//Plane
p.Plane = agb.GetActivePlane();
p.Origin = p.Plane.GetOrigin();
p.XAxis = p.Plane.GetXAxis();
p.YAxis = p.Plane.GetYAxis();

//Sketch1
p.Sk1 = p.Plane.NewSketch();
p.Sk1.Name = "Sketch";

//Edges
with (p.Sk1)
{
a=10
b=20
h=20
p.Ln11 = Line(a,0,b,0);
p.Ln12 = Line(b,0,b,h);
p.Ln13 = Line(b,h,a,h);
p.Ln14 = Line(a,h,a,0);
}


//Sketch2
p.Sk2 = p.Plane.NewSketch();
p.Sk2.Name = "Sketch2";

//Edges
with (p.Sk2)
{
a=14;
b=24;
h=10;
h0=12;
p.Ln21 = Line(a,h0,b,h0);
p.Ln22 = Line(b,h0,b,h0+h);
p.Ln23 = Line(b,h0+h,a,h+h0);
p.Ln24 = Line(a,h+h0,a,h0);
}

//Dimensions and/or constraints
with (p.Plane)
{

}
p.Plane.EvalDimCons(); //Final evaluate of all dimensions and constraints in plane
return p;
} //End Plane JScript function: planeSketchesOnly

//Call Plane JScript function
var ps1 = planeSketchesOnly (new Object());

var MyRevolve1 = agb.Revolve(agc.Add,
ps1.Sk1,
ps1.YAxis,
agc.DirNormal,
360.0,
0.0,
agc.No,
0.0,
0.0);
agb.Regen();

var MyRevolve2 = agb.Revolve(agc.Frozen,
ps1.Sk2,
ps1.YAxis,
agc.DirNormal,
3.0,
0.0,
agc.No,
0.0,
0.0);
agb.Regen(); //To insure model validity
// Key Code
var PF1 = ag.gui.CreateSpot();
ag.listview.ActivateItem("Type");
ag.listview.ItemValue = "Construction Point";
ag.listview.ActivateItem("Definition");
ag.listview.ItemValue = "Manual Input";
ag.listview.ActivateItem("FD8, X Coordinate");
ag.listview.ItemValue = "0";
ag.listview.ActivateItem("FD9, Y Coordinate");
ag.listview.ItemValue = "0";
ag.listview.ActivateItem("FD10, Z Coordinate");
ag.listview.ItemValue = "0";
agb.Regen();

var PF2 = ag.gui.CreateSpot();
ag.listview.ActivateItem("Type");
ag.listview.ItemValue = "Construction Point";
ag.listview.ActivateItem("Definition");
ag.listview.ItemValue = "Manual Input";
ag.listview.ActivateItem("FD8, X Coordinate");
ag.listview.ItemValue = "0";
ag.listview.ActivateItem("FD9, Y Coordinate");
ag.listview.ItemValue = "100";
ag.listview.ActivateItem("FD10, Z Coordinate");
ag.listview.ItemValue = "0";
agb.Regen();
var LF1 = agb.LinePt();
LF1.AddSegment(PF1.GetPoint(1, 0),PF2.GetPoint(1, 0), 0);
agb.Regen();
//===================

var MyPattern = ag.gui.CreatePattern();
MyPattern.Name="Pattern1";
ag.listview.ActivateItem("Pattern Type");
ag.listview.ItemValue = "Circular";

ag.listview.ActivateItem("Geometry");
agb.ClearSelections();
body1 = ag.fm.Body(1);
agb.AddSelect(agc.TypeBody, body1);
ag.listview.ItemValue = "Apply";

//===========================================
ag.listview.ActivateItem("Axis");
ag.edgePick;
ag.gui.SelectAll();
ag.listview.ItemValue = "Apply";
//===========================================

ag.listview.ActivateItem("FD2, Angle");
//ag.listview.ItemValue = "Evently Spaced";
ag.listview.ItemValue = "40";

ag.listview.ActivateItem("FD3, Copies (>=0)");
ag.listview.ItemValue = "8";
agb.Regen();
Vallence is offline   Reply With Quote

Old   June 14, 2017, 02:32
Default
  #9
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
good work and thanks for posting final codes.
Kapi is offline   Reply With Quote

Old   June 14, 2017, 03:44
Default
  #10
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14
Kapi is on a distinguished road
Hey vallence,

Did this work because you changed the geometry?
previously 1 of the edges was coming in center which is why you were trying for Y axis in XY plane.
New geometry shows the body is away from center, is that why
Quote:
ag.edgePick;
worked?

Cheers
KAPI
Kapi is offline   Reply With Quote

Old   June 14, 2017, 03:57
Default Explain
  #11
New Member
 
LC
Join Date: Jun 2017
Posts: 6
Rep Power: 9
Vallence is on a distinguished road
I tried different a'values while I was debugging the code.Different a shows different result. Under current code,the final result can not vary with
a.

with (p.Sk2)
{
a=15 //when a=0 the final result is the same
b=24
h=10
h0=12
p.Ln21 = Line(a,h0,b,h0);
p.Ln22 = Line(b,h0,b,h0+h);
p.Ln23 = Line(b,h0+h,a,h+h0);
p.Ln24 = Line(a,h+h0,a,h0);
}
Vallence is offline   Reply With Quote

Reply

Tags
axis, pattern


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lets talk about relaxation factor optimization chriss85 OpenFOAM Running, Solving & CFD 35 June 21, 2019 10:54
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 10:56
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 07:59
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


All times are GMT -4. The time now is 17:56.