-
February 22nd, 2011, 09:30 PM
#1
make autocomplete stuff
Hi folk,
Example: In the Excel, if you type "=s" in one of the cells, a list of commands with their required format opens up which is a great help in a sense that you don't need to memorize the exact format of commands.
My problem:
I'm using an engineering software. It needs me to write codes based on its specific internally designed language (so it's not a known language like c++ or ...) and the commands have definitely specific formats.
The software is not very old so it doesn't have an "interpreter" or those facilitating things that we have in Java GUIs like Netbeans.
I need to write the code in a text editor, save it as .dat and call it through the software.
My dream
For example one of the commands is "gen" and the format is:
gen id= , rad= , x= , y= , z= ,
and it basically generates a number of balls with the IDs as I specify.
Is there anyway I can make something like Excel, kind of easily, so that when I type "gen" something shows up and tells me the format?
I appreciate any opinion.
Thanks
-
February 23rd, 2011, 07:45 PM
#2
-
February 23rd, 2011, 08:39 PM
#3
Of course,
There is this company called Itasca
http://www.itascacg.com/pfc3d/
It has a couple of softwares two of which are FLAC (fast Lagrangian code) and PFC (particle flow code). They have a built-in language called FISH. The FISH language is C++ based by which I mean there should be some internal codes to do the stuff but since most engineers are not that good in programing they have, I suppose, assigned commands to these internal codes to make life easier.
I'm using windows 7 professional in my DELL Studio XPS 435T setup for doing these stuff.
FYI: One example is the ball command that I wrote above. For example if you want to model a particulate medium like soil by "distinct (or discrete) element modeling" you're gonna need to create bunch of particles. So instead of having to write a long c++ code to do that, you just need to use that "ball" command and then you need to make "walls" and apply forces and blahblahblah
FYI: This is one very simple sample of code:
The software does not have an interpreter so it's really a pain...if you make mistakes like typos it gives you errors but not that type of neat cute concise errors that we get in like Netbeans! So yea I was just wondering if I can make my life a little bit easier by making such a autocomplete thing to write codes....actually now that I'm thinking about, maybe having them on a piece of paper besides me will be easier but there are really so many commands...below example contains lots of normal mathematical stuff that I'm NOT talking about...I'm talking about the internal commands like "gen" "wall" "fric" "print" etc.
;fname: expand.DAT
new
SET random ; reset random-number generator
; ---------------------------------------------
def expand
;--- input data ---
n_stiff = 1e8 ; normal contact stiffness
s_stiff = 1e8 ; shear contact stiffness
width = 10.0 ; width of box
height = 5.0 ; height of box
depth = 5.0 ; depth of box
tot_vol = width*height*depth
poros = 0.40 ; desired final porosity
num = 200 ; number of particles
rat = 1.5 ; ratio of largest to smallest radii
;--- derived data ---
mult = 1.6 ; initial radius multiplication factor
n0 = 1.0 - (1.0 - poros) / mult^3
r0 = (3.0*tot_vol*(1.0 - n0)/(4.0*pi*num))^(1.0/3.0)
rlo = 2.0 * r0 / (1.0 + rat)
rhi = rat * rlo
;--- add six infinite walls to bound the specified volume
command
wall id=1 ks=s_stiff kn=n_stiff norm=( 0, 1, 0) orig=(0,0,0)
wall id=2 ks=s_stiff kn=n_stiff norm=(-1, 0, 0) orig=(width,0,0)
wall id=3 ks=s_stiff kn=n_stiff norm=( 0,-1, 0) orig=(0,height,0)
wall id=4 ks=s_stiff kn=n_stiff norm=( 1, 0, 0) orig=(0,0,0)
wall id=5 ks=s_stiff kn=n_stiff norm=( 0, 0, 1) orig=(0,0,0)
wall id=6 ks=s_stiff kn=n_stiff norm=( 0, 0,-1) orig=(0,0,depth)
end_command
;--- generate the balls and give them their properties
command
gen id=1,num rad=rlo,rhi x=0,width y=0,height z=0,depth
prop dens=1000 ks=s_stiff kn=n_stiff
end_command
get_poros
_mult = ((1.0 - poros) / (1.0 - pmeas))^(1.0/3.0)
command
initial radius mul _mult
cycle 1000
prop fric 0.2
cycle 250
end_command
end
; ---------------------------------------------
def get_poros
sum = 0.0
bp = ball_head
loop while bp # null
sum = sum + (4.0/3.0) * pi * b_rad(bp)^3
bp = b_next(bp)
end_loop
pmeas = 1.0 - sum / tot_vol
end
expand
get_poros
plot create the_view
plot add ball yellow
plot add axes black
plot add cf blue
plot set rotation (30 0 30)
plot show
print pmeas
save expand.SAV
Last edited by boyboy400; February 23rd, 2011 at 08:43 PM.
-
February 25th, 2011, 12:58 PM
#4
Hmmm,
Firstly, it is not in the interests of the vendors of this type of application to make it simple or easy to use. They make money out of training, and want the ability to use their software effectively to be a skillset in its own right.
I see not much has changed since my days in the armaments industry.
The first thing you might like to look at is creating your own user defined model templates. This works if a lot of what you do falls into groups of similar items. If possible create the template data in a different font or colour so that you can easily see what you have overwritten or not Because there are already data there it should prompt you to remember the parameters and values?
You could also look at a database of commands and input forms in something like Access? This might slightly speed things up, but it would take a fair bit of setting up I would imagine. I haven't looked at very recent versions of office but Access certainly used to let you define your own prompt screens and to verify input against permitted parameters.
I really don't see any future in looking at the underlying code. What they appear to have done is created their own "higher level language" that sits on top of it.
Similar Threads
-
By akachuckie in forum The Security Tutorials Forum
Replies: 8
Last Post: February 24th, 2005, 01:47 AM
-
By gore in forum Operating Systems
Replies: 13
Last Post: June 9th, 2004, 02:44 AM
-
By volcanic in forum Other Tutorials Forum
Replies: 2
Last Post: October 26th, 2003, 07:02 PM
-
By -DaRK-RaiDeR- in forum Newbie Security Questions
Replies: 9
Last Post: December 14th, 2002, 08:38 PM
-
By Badassatchu in forum Non-Security Archives
Replies: 1
Last Post: November 23rd, 2001, 11:13 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|