gallo Posted June 5, 2004 Share Posted June 5, 2004 Hello, first of all excuse me for my english... I wrote a "point object" with vectorscript. I cannot understand how to define fields in a record ad the same time when the object is created. In a document I create a record (DIMENSIONS) with the following fields: DIAMETER LENGHT I would like put automatically the Parametric Data in the fields so in the "point object" script i use this functions: SetRecord(handle,recname); SetRField(handle,recname,field,string); I cannot understand which kind of handle i have to use to fill-in the field at same time when the object is placed. I tried in many different ways but nothing to do! It doesn't works... ( Someone can help me? Thanks a lot This is the complete script: --------------------------------- Procedure curva; VAR sin45,cos45,sin30,cos30,x,y,x1,y1,x2,y2,x3,y3:real; recname,valorediam:STRING; BEGIN SetRecord(FActLayer,recname); SetRField(FActLayer,recname,'tipo','curva'); SetRField(FActLayer,recname,'diametro',valorediam); recname:='dimensioni'; valorediam:=num2str(3,PD); sin45:=sin(0.785398163); cos45:=cos(0.785398163); sin30:=sin(1.047197551); cos30:=cos(1.047197551); x:=PD-(cos45*0.5*PD); y:=-PD+(sin45*0.5*PD); x1:=PD-(cos45*1.5*PD); y1:=-PD+(sin45*1.5*PD); x2:=PD-(cos30*0.5*PD); y2:=-PD+(sin30*0.5*PD); x3:=PD-(cos30*1.5*PD); y3:=-PD+(sin30*1.5*PD); if (Pangolo='90') then begin arc(-PD/2,PD/2,5/2*PD,-5/2*PD,#90?,#90?); arc(PD/2,-PD/2,3/2*PD,-3/2*PD,#90?,#90?); moveto(-PD/2,-PD); lineto(PD/2,-PD); moveto(PD,PD/2); lineto(PD,-PD/2); locus(0,0); end else if (pangolo='45') then begin arc(-PD/2,PD/2,5/2*PD,-5/2*PD,#90?,#45?); arc(PD/2,-PD/2,3/2*PD,-3/2*PD,#90?,#45?); moveto(x,y); lineto(x1,y1); moveto(PD,PD/2); lineto(PD,-PD/2); locus(0,0); end else if (pangolo='30') then begin arc(-PD/2,PD/2,5/2*PD,-5/2*PD,#90?,#30?); arc(PD/2,-PD/2,3/2*PD,-3/2*PD,#90?,#30?); moveto(x2,y2); lineto(x3,y3); moveto(PD,PD/2); lineto(PD,-PD/2); locus(0,0); end; end; run(curva); Quote Link to comment
gallo Posted June 26, 2004 Author Share Posted June 26, 2004 Hello, no one can help me?!? Quote Link to comment
ccroft Posted June 26, 2004 Share Posted June 26, 2004 I use GetCustomObjectInfo(objName,objHand,objRecHand,wallHand); SetRecord(objHand,recname); SetRField(objHand,recname,'diametro',valorediam); GetCustomObjectInfo will get the handle to the PIO that it is called in,along with the other handles. In this case objRecHand is the handle to the record that contains the parameter values of the PIO and not the record that you are attaching. Also, you might want to move this stuff to the end of the script so that the variables recname and valorediam have been assigned values before you call them. You can also use 'dimensioni' directly in SetRField instead of a variable if you want. Either way you use it ,make very sure that it is typed exactly the same as the name of the record.....obvious I know, but it's happened to me with a space that shouldn't be there. Hope this works for you charles Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.