|
[Sponsors] |
[DesignModeler] How to Pass values from python journal file to .js file? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 30, 2015, 08:50 |
How to Pass values from python journal file to .js file?
|
#1 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 11 |
Hello,
I have a journal file run.py file and I am starting a jscript file dm.js from this journal file with sendcommand function I need to pass values I have calculated in journal file to this js file. Is there way that these values can be sent through sendcommand function as an argument? I have tried python file creating a text file and js file reading it. But the file handling functions seem a but tough. Any help is appreciated. Thanks |
|
April 30, 2015, 18:53 |
|
#2 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Kar,
Could you post your code how you are working it out, whr u r calculating values and why you want it to go to JS file. KAPI |
|
May 2, 2015, 06:24 |
|
#3 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 11 |
Hello Kapi,
I am taking values from excel file in journal file. Some of these values include meshing sizes. You might be well aware of it, but my journal file code typically looks like this: Code:
meshmin = worksheet.cell["A20"].value Code:
Mesh1.sendcommand (script.read()) Code:
mesh1.sendcommand (script.read(),meshmin) Kartiki |
|
May 3, 2015, 22:27 |
|
#4 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Kar,
You can call Excel values in JS directly rather than calling values in Journal file then giving values to JS file. This I reckon will be much neater way to use excel with JS. Code:
var excel = new ActiveXObject("Excel.Application"); var excel_file = excel.Workbooks.Open("Excel file path"); var excel_sheet = excel.Worksheets("Sheet1); meshmin = excel_sheet.Cells(20,1).value; Cheers KAPI |
|
May 4, 2015, 09:11 |
|
#5 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 11 |
Thanks Kapi!!!
That worked. There was a question on adding mesh method. I am trying to add Multizone method and the code I am using looks like Code:
sm.AddToSelection(1,0,false); var MeshCtrlObj = meshGroup.AddMeshControl(sm,DS.Script.id_BodyMeshType); MeshCtrlObj.Value = 7; // defines multizone method MeshCtrlObj.SourceTargetSelection = 1; // says to have geometry selection MeshCtrlObj.SourceGeometry = sm; // gives input geometry DS.Script.fillTree(); Thanks, Kartiki |
|
May 4, 2015, 18:52 |
|
#6 | |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Kar,
Quote:
Code:
sm.AddToSelection(partID[i], aTopoId, false); Hope it helps Cheers KAPI |
||
May 5, 2015, 00:22 |
|
#7 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 11 |
Yes.. I am aware of it. I am actually trying to specify named selection instead of Geometry Selection, cause choosing the parts of geometry would be kind of difficult in my case.
|
|
May 5, 2015, 00:55 |
|
#8 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Kar,
I dont think you can specify Named selection in Source Geometry manually or by Script or even store Named selection in place of Part ID and Topo ID in SM! Give it a go and let me know if it pans out for u! Cheers KAPI |
|
May 5, 2015, 02:49 |
|
#9 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 11 |
yup.. will do.. Thanks!!!
I have some more questions: 1. Is there any property of bodies and faces in design modeler that will specify it's distance from coordinate system? 2. Also if I have id for a body, can I identify bodies that interface with it? 3. Is there any property of a face that says its flat and not curved? Thanks, Kartiki |
|
May 5, 2015, 18:57 |
|
#10 | |||
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Kar,
Quote:
There is a tool called "distance finder" it can help you find distance between two entitites but not Coordinate system Quote:
Quote:
Once you select this tool, it will give all information about the point/edge/face/body selected Hope it helps Cheers KAPI |
||||
May 6, 2015, 05:28 |
|
#11 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 11 |
Thanks Kapi,
How to program distance finder? I need to find distance between a body and a point. I have searched for it in installation folder and on net but couldnot get anything relative. In meshing, GrowthRateSF is the command to use to edit value of growth rate in inflation in global mesh parameters, I think. But the following code does not work. It gives error as 'Object doesn't support this property or method' Code:
var meshGroup = DS.Tree.FirstActiveBranch.MeshControlGroup; DS.Script.changeActiveObject(meshGroup.ID); meshGroup.GrowthRateSF = 1.2556; Last edited by kar.coep; May 6, 2015 at 08:36. |
|
May 7, 2015, 01:24 |
|
#12 | |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Kar,
Tried to look for Distance finder but cudnt get anything solid! Found the below codes but not sure if/how they will work! Code:
1: var enable = ag.gui.ProcessButtons("ID_AT_DistanceFinder", mode); agMode_enable(button, enable); 2: ag.gui.CreateDimensionDistance() 3: agToolsHandler("ID_AT_DistanceFinder", 1603) Regarding Growth rate Quote:
Not able to locate it yet but should be something similar. Will update you if I find something on these! Cheers KAPI |
||
May 7, 2015, 02:28 |
|
#13 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 11 |
Hi Kapi,
In ACT reference guide Distance function is mentioned under iQueries as: Distance(IEnumerable<IPSGeoEntity>, IEnumerable<IPSGeoEntity>) are you aware of this? I am not sure how to use it in .js file. Also in ageventhandler in installation folder, there is this code: ag.gui.CreateAnalysisTools(eventID); switch(eventID) { case 0: // Distance finder activeProp = "ID_EntitySet1"; break; case 2: // Bounding box case 3: // Mass properties case 4: // Fault detect case 5: // Small Entity Search activeProp = "ID_EntitySet"; break; case 6: // Body clash search activeProp = "ID_AnalysisToolsBodies"; break; } agListviewAnalysisTools(); listviewActivateProp(activeProp); agGUI_OnCursorWaitOFF(); } CreateAnalysisTools() command doesnot give any error. But not sure how to give arguments of 2 bodies to it |
|
May 7, 2015, 09:31 |
|
#14 |
Member
Join Date: Oct 2014
Posts: 44
Rep Power: 11 |
I have solved the question posted above and would be posting the code soon.
Code:
var bodyno = ag.agApplet.FeatureMgr.BodyCount; var faceno; var totalfaces = new Array(); var facelbs =new Array(); var m=0; var fcc, facelb; for (var i=1;i<bodyno;i++) { var inlet = ag.fm.Body(i); var bodylb = inlet.Label; ag.m.FindEntity(0, 0, bodylb, 0); ag.m.SelectionMgr.ShowTopologicalConnections(0); faceno = ag.m.GetFaceSelListSize(); for (var j=0;j<faceno;j++) { fcc = ag.m.GetFaceSelListIndex(j); facelb = fcc.Label; totalfaces[m] = find_distance(facelb,ptlb); facelbs[m] = facelb; m = m+1; } fcc = ag.m.GetFaceSelListIndex(j); what can cause it? or would be there be any other way that can go through each face of a body? |
|
May 7, 2015, 22:43 |
|
#15 | ||
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi kar,
Quote:
Did you try to see what happens when you call this function? What features are being stored in it? Once you find what u r getting in the output window of VS, you can just scroll thru the steps to find distance finder and use the same in code. Good you have the solution now, It will be beneficial for everyone if you can post those codes here! Quote:
Cheers KAPI |
|||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
wmake compiling new solver | mksca | OpenFOAM Programming & Development | 14 | June 22, 2018 06:29 |
[swak4Foam] Error bulding swak4Foam | sfigato | OpenFOAM Community Contributions | 18 | August 22, 2013 12:41 |
[swak4Foam] swak4Foam-groovyBC build problem | zxj160 | OpenFOAM Community Contributions | 18 | July 30, 2013 13:14 |
ParaView Compilation | jakaranda | OpenFOAM Installation | 3 | October 27, 2008 11:46 |
error while compiling the USER Sub routine | CFD user | CFX | 3 | November 25, 2002 15:16 |