[Scilab-users] STEP- Datei
Serge Steer
Serge.Steer at inria.fr
Thu Aug 1 13:54:47 CEST 2013
Please find attached a Scilab function which is able to translated step
instructions into Scilab ones. It remains an important problem I was not
able to solve yet: The step instructions are not ordered so they can be
evaluated in sequence.
May be it will be enough for your purpose (if you only want to get only
some data)
Serge Steer
Le 31/07/2013 14:15, Pascal Buehler a écrit :
> Hi there, my name is Pascal,
>
> i want to load a STEP file into Scilab. Now, my problem is to seperate
> the koordinates from the String!
> I tried various things but non of the is satifying.
> the goal ist to make the koordinates from string into a matrix of
> nubers and to display in a figure.
> Anyone who knows an elegant way?
>
> Here the files
>
>
>
> PS: Something like Opacity in the Scirendere would be nice.
>
> with best regards / mit freundlichen Grüssen
>
> Pascal Bühler
> Qualität-Hardware / Prüfingenieur
> SAUTER HeadOffice
> Fr. Sauter AG
> Im Surinam 55, CH-4016 Basel
> Telefon +41 (0)61 695 5646
> Telefax +41 (0)61 695 5619
> http://www.sauter-controls.com <http://www.sauter-controls.com/>
>
> DISCLAIMER:
> This communication, and the information it contains is for the sole use of
> the intended recipient. It is confidential, may be legally privileged and
> protected by law. Unauthorized use, copying or disclosure of any part
> thereof may be unlawful. If you have received this communication in error,
> please destroy all copies and kindly notify the sender.
>
> Before printing out this e-mail or its attachments, please consider
> whether
> it is really necessary to do so.
> Using less paper helps the environment.
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20130801/67f0dfad/attachment.htm>
-------------- next part --------------
function step2sci(fil)
t=mgetl(fil);
k=grep(t,"DATA;");
t=t(k:$);
t(grep(t,"+^ *$+",'r'))=[];//remove empty lines
t=strsubst(t(k:$),"+/.*/+","","r");//remove comments
//catenate multilines instructions
keoi=grep(t,";");
t1=[];k=1
for i=1:size(keoi,"*")
t1=[t1;strcat(t(k:keoi(i)),",")];
k=keoi(i)+1;
end
t=t1;
t=strsubst(t,',,',',');
//replace (...) by list(...)
t=strsubst(t,"=(,","=list(");
t=strsubst(t,"((","(list(");
t=strsubst(t,"=(","=list(");
t=strsubst(t,",(",",list(");
t=strsubst(t,",)",")");
//replace .var. by "var"
t=strsubst(t,"(.","(''") ;
t=strsubst(t,".)","'')");
t=strsubst(t,".,","'',");
t=strsubst(t,",.",",''");
t=strsubst(t,"*","''*''");
k=grep(t,"ENDSEC");
t=t(1:k-1)
//list the used functions
mputl(['function foo';t;"endfunction"],"/tmp/foo.sci")
exec /tmp/foo.sci;
vars=macrovar(foo);
funs=stripblanks(unique([vars(3);vars(4)]));
funs(funs=="")=[];
funs(funs=="list")=[];
funs(funs=="$")=[];
funs(part(funs,1)=="#")=[];
//create the requested functions
F="function r="+funs+"(varargin);r=tlist("""+funs+""",varargin(:));endfunction"
//Order the instructions
code=bytecode(foo);
global T;T=[]
warning("off")
nsiz=6
bytecodewalk(code(22:$),2,job);
pause
mputl([F;t],strsubst(fil,".stp",".sce"))
endfunction
function v=code2var(id)
nsiz=6
i1=1
if size(id,'*')<nsiz then id($+1:nsiz)=673720360,end
for l=1:nsiz
idl=id(l)
for i=i1:i1+3
k=int((idl+128)/256)
if k<0 then k=k-1,end
ch=idl-256*k
if ch==40 then
n=i-1
v=code2str(str)
return
end
idl=k
str(i)=ch
end
i1=i1+4
v=code2str(str)
end
endfunction
function [ctemp,lc]=job(lc);
global T
v=code2var(double(code(lc+1:lc+6)));
if part(v,1)=="#" then T=[T;v];end
ctemp=code(lc:lc+8)
lc=lc+9
endfunction
More information about the users
mailing list