Book a Demo

Author Topic: Constraint Block script in SysML  (Read 6627 times)

blabla

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Constraint Block script in SysML
« on: May 07, 2015, 11:36:02 pm »
I would like to read data from a excel file
in a constraint block script

how could I do this? or is this not possible

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Constraint Block script in SysML
« Reply #1 on: May 08, 2015, 12:27:16 am »
Ehrm, what is a constraint block script?

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Constraint Block script in SysML
« Reply #2 on: May 08, 2015, 08:34:35 am »
qwerty - A constraint block is a unit of behavior in a parametric diagram. In EA, that is defined using a one of the scripting languages EA supports. (I can't remember which. It's been a long time)

blabla - You should be able to create an activex object to read from excel. The complicating factor is that your script is used inside a larger script and I'm not sure how that will interact.
« Last Edit: May 08, 2015, 08:35:27 am by simonm »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Constraint Block script in SysML
« Reply #3 on: May 08, 2015, 06:20:21 pm »
Oops. I missed the SysML in the title  :-[ Thanks for clarification.

q.
« Last Edit: May 08, 2015, 06:20:37 pm by qwerty »

blabla

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Constraint Block script in SysML
« Reply #4 on: May 15, 2015, 04:06:56 pm »
My idea is to add a vba script to a constraint block. With the vba script I can read the excel sheet

blabla

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: Constraint Block script in SysML
« Reply #5 on: May 15, 2015, 06:43:31 pm »
Does anyone know why this code doesn't work? Script language = java

Code: [Select]
int a=400;
output=a

if I write this code it works
Code: [Select]
output=400

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Constraint Block script in SysML
« Reply #6 on: May 20, 2015, 09:08:59 am »
You're using javascript not java. It's not a strictly typed language and doesn't know what to do with the "int".