Jump to content

Fuge

Member
  • Posts

    120
  • Joined

  • Last visited

Everything posted by Fuge

  1. Try this for scrolling through the class list and setting the active class.Dave -----------------Procedure CycleClasses;VARkeypressed:LONGINT;ClassName:STRING;i: INTEGER; BEGINi:=1;RepeatClassName:= ClassList(i);Message('Class Name: ',ClassName,', Hit the Return key to make this the active class.');GetKeyDown(keypressed); If KeyPressed = 29 THENBEGIN If i = ClassNum then BEGIN ClassName:= ClassList(i); Message('Class Name: ',ClassName,', Hit the Return key to make this the active class.'); i:=1; END ELSEBEGINClassName:= ClassList(i);Message('Class Name:',ClassName,', Hit the Return key to make this the active class.');i:=i+1;End;End; If KeyPressed = 28 THENBEGIN If i = 1 then BEGIN ClassName:= ClassList(i); Message('Class Name: ',ClassName,', Hit the Return key to make this the active class.'); i:= ClassNum; END ELSEBEGINClassName:= ClassList(i);Message('Class Name: ',ClassName,', Hit the Return key to make this the active class.');i:=i-1;End;End; UNTIL KeyPressed = 13;NameClass(ClassName);ClrMessage;END;Run (CycleClasses);
  2. In VectorWorks 9 "Type" can no longer be a variable. It is now a reserved word. Dave
  3. You can't execute a script by changing an objects layer from the Object Info palette. You could write a menu script however to ask what layer to move the object to and have it scale it. That's do-able. Fuge [ 05-13-2002: Message edited by: Fuge ]
  4. George, Here's something written a while back that can be modified to fit your needs. Select the object and either add or edit the record attached. Add this as a menu plug-in item and give it a try. It should give you the idea on how it can be done in VS. Dave Procedure EditAddObjRec;{* Created by Dave Fugiel 2/13/99*}LABEL 10,99; CONST kRec = 'Nimlok DB'; VAR Abort, Mac , yes : BOOLEAN; x , y : REAL; STR1 , STR2 , STR3 , STR4 , STR5 , STR6 , STR7 , STR8 : STRING; RF1, RF2 , RF3 , RF4 , RF5 , RF6 , RF7 , RF8 :STRING; Obhd , CustomObj : HANDLE; ObjectCount : LONGINT; ObjTyp : INTEGER; Recordhand,h ,RecordExist : HANDLE; Procedure AddtheRecord;BEGIN Recordhand:=GetObject(kRec); RecordExist := GetRecord(Obhd,1); IF Recordhand = Nil THEN BEGIN NewField(kRec, 'Code' , '',4,1); NewField(kRec, 'Description' , '',4,1); NewField(kRec, 'Price' ,'',6,2); NewField(kRec, 'Weight' , '',6,2); NewField(kRec, 'Rentable' , '',4,1); NewField(kRec,'WSR No','',6,0); NewField(kRec,'Pack No','',6,0); NewField(kRec,'Obj Type','',6,0);END;END; Procedure TheDialog;VAR Width,x1,y1,x2,y2,px1,px2,px3,px4,py1,py2,py3,py4 : INTEGER; Procedure AlignScr ( Height, Width : INTEGER; VAR x1, x2, y1 : INTEGER );VAR scrx1, scry1, scrx2, scry2 : INTEGER; BEGIN GetScreen ( scrx1, scry1, scrx2, scry2 ); x1 := ( ( scrx1 + scrx2 ) DIV 2 ) - ( Width DIV 2 ); x2 := x1 + Width; y1 := ( scry2 - scry1 - Height ) DIV 3;END; Procedure LocateButtons ( DialogType, scnh, scnw : INTEGER );VAR v1, v2, v3, v4 : INTEGER; Procedure Swap ( VAR m1, m2, m3, m4 : INTEGER );VAR Temp : INTEGER; BEGIN Temp := m1; m1 := m3; m3 := Temp; Temp := m2; m2 := m4; m4 := Temp;END; { of Swap } BEGIN GetVersion ( v1, v2, v3, v4 ); Mac := ( v4 = 1 ); IF DialogType = 1 THEN BEGIN px1 := ( scnw DIV 2 ) - 80; px2 := ( scnw DIV 2 ) - 10; px3 := ( scnw DIV 2 ) + 10; px4 := ( scnw DIV 2 ) + 80; IF Mac THEN SWAP ( px1, px2, px3, px4 ); py1 := scnh - 40; py2 := scnh - 20; py3 := py1; py4 := py2; END ELSE IF DialogType = 2 THEN BEGIN px1 := scnw - 180; px2 := scnw - 110; px3 := scnw - 90; px4 := scnw - 20; IF Mac THEN SWAP ( px1, px2, px3, px4 ); py1 := scnh - 40; py2 := scnh - 20; py3 := py1; py4 := py2; END ELSE BEGIN px1 := scnw - 90; px2 := scnw - 20; px3 := px1; px4 := px2; py1 := scnh -70; py2 := scnh - 50; py3 := scnh - 40; py4 := scnh - 20; IF Mac THEN SWAP ( py1, py2, py3, py4 ); END;END; { of Locate Buttons } Procedure MakeDialog;CONST scnh = 335; scnw = 320; DialogType = 3; BEGIN AlignScr ( scnh, scnw, x1, x2, y1); y2 := y1 + scnh; LocateButtons ( DialogType, scnh, scnw ); BeginDialog ( 1, 1, x1, y1, x2, y2 ); AddButton ( 'OK', 1, 1, px1, py1, px2, py2 ); AddButton ( 'Cancel', 2, 1, px3, py3, px4, py4 ); AddField ( 'Code:' , 3, 1, 10, 20 , 85, 35 ); AddField ( '' ,4, 2, 95, 20 , 305, 35 ); AddField ( 'Description:' , 5, 1, 10, 50 , 85, 65 ); AddField ( '' ,6, 2, 95, 50 , 305, 65 ); AddField ( 'Price:' , 7, 1, 10, 80 , 85, 95 ); AddField ( '' ,8, 2, 95, 80 , 305, 95 ); AddField ( 'Weight:' , 9, 1, 10, 110 , 85, 125 ); AddField ( '' ,10, 2, 95, 110 , 305, 125 ); AddField ( 'Rentable:' , 11, 1, 10, 140 , 85, 155 ); AddField ( '' ,12, 2, 95, 140 , 305, 155 ); AddField ( 'WSR No:' , 13, 1, 10, 170 , 85, 185 ); AddField ( '' ,14, 2, 95, 170 , 305, 185 ); AddField ( 'Pack No:' , 15, 1, 10, 200 , 85, 215 ); AddField ( '' ,16, 2, 95, 200 , 305, 215 ); AddField ( 'Obj Type:' , 17, 1, 10, 230 , 85, 245 ); AddField ( '' ,18, 2, 95, 230 , 305, 245 ); EndDialog;END; BEGIN MakeDialog;END; Procedure GetInfo;LABEL 10 , 99; VAR item : INTEGER; Done , OK : BOOLEAN; BEGIN Done := FALSE; Abort := FALSE; RF1 := ''; RF2 := ''; RF3 := ''; RF4 := ''; RF5 := ''; RF6 := ''; RF7 := ''; RF8 := ''; Obhd := LSActLayer; IF Obhd <> NIL THENBEGINAddtheRecord; RF1 := EvalStr ( Obhd , ('Nimlok DB'.'Code'));RF2 := EvalStr ( Obhd , ('Nimlok DB'.'Description'));RF3 := EvalStr ( Obhd , ('Nimlok DB'.'Price'));RF4 := EvalStr ( Obhd , ('Nimlok DB'.'Weight'));RF5 := EvalStr ( Obhd , ('Nimlok DB'.'Rentable'));RF6 := EvalStr ( Obhd , ('Nimlok DB'.'WSR No'));RF7 := EvalStr ( Obhd , ('Nimlok DB'.'Pack No'));RF8 := EvalStr ( Obhd , ('Nimlok DB'.'Obj Type'));END; GetDialog ( 1 ); SetTitle ( 'Edit/ Add Record Info' ); SelField ( 4 ); SetField ( 4, RF1 ); SetField ( 6, RF2 ); SetField ( 8, RF3 ); SetField ( 10, RF4 ); SetField ( 12, RF5 ); SetField ( 14, RF6 ); SetField ( 16, RF7 ); SetField ( 18, RF8 ); 10:REPEAT DialogEvent ( Item ); CASE item OF 1 : Done := True; 2 : BEGIN Done := TRUE; Abort := TRUE; END; END; { of CASE }UNTIL Done; IF Abort THEN GOTO 99; STR1 := GetField ( 4 ); STR2 := GetField ( 6 ); STR3 := GetField ( 8 ); STR4 := GetField ( 10 ); STR5 := GetField ( 12 ); STR6 := GetField ( 14 ); STR7 := GetField ( 16 ); STR8 := GetField ( 18 ); 99 : ClrDialog; END; PROCEDURE ObjFrom;BEGIN IF Obhd <> NIL THEN CustomObj := Obhd ELSE CustomObj := LNewObj; END; Procedure AddRecordInfo; BEGIN ObjFrom; SetRecord ( CustomObj ,'Nimlok DB' ); SetRField ( CustomObj ,'Nimlok DB','Code',STR1 ); SetRField ( CustomObj ,'Nimlok DB','Description', STR2 ); SetRField ( CustomObj , 'Nimlok DB' , 'Price' , STR3 ); SetRField ( CustomObj , 'Nimlok DB' , 'Weight' , STR4 ); SetRField ( CustomObj , 'Nimlok DB' , 'Rentable' , STR5 ); SetRField ( CustomObj , 'Nimlok DB' , 'WSR No' , STR6 ); SetRField ( CustomObj , 'Nimlok DB' , 'Pack No' , STR7 ); SetRField ( CustomObj , 'Nimlok DB' , 'Obj Type' ,STR8 ); END; BEGIN ObjTyp := GetType ( LSActLayer ); IF LSActlayer = NIL THEN BEGINSysbeep; AlrtDialog ( 'Select something to edit first knuckle head!' ); GOTO 99; END; ObjectCount := Count ( ( SEL = TRUE ) ); IF ( ObjectCount > 1) & ( ObjTyp <> 11 ) THEN BEGIN Sysbeep; AlrtDialog ( 'Sorry, You have more than one object selected, Select only one!' ); GOTO 99; END; TheDialog; GetInfo; IF Abort THEN GOTO 99;AddRecordInfo;99 : END;Run ( EditAddObjRec );
  5. If I understand you correct. Draw a circle and a 2d locus side by side.The distance of your 2d locus from your circle will be the radius of your spring. Selectboth and do a menu "Sweep.." command. enter the degrees and a pitch to create your spiral spring. Fuge
  6. There are many objects that do not get exported when exporting as a vector script file. Your drawing will never end up importing back in the way it was when it was exported. I would find an alternative way of setting up your revision control system. Dave
  7. Check out this link for plug-in object examples for creating the different type of boards you want. It's probably your best starting point. HTHDave http://www.nemetschek.net/support/custom/vscript/example.html
  8. Vectorworks really needs the ability to truely communicate with other databases. Exportingor writing text files to be read by another program doesn't cut it. Third party developers have tried writing plug-ins to exchange data between VectorWorks and other programs that support ODBC, but these solutions just don't work and are not very well supported. I have first hand experience. So where does that leave users who need this higher end feature that other CAD program already provide? I believe that NNA does NOT realize the importance of this feature and how important it will become to the future of VW's. Larger firms will never even consider VW's as a solution if data exchange is not part of the products. NNA bases their future product features two ways. Are enough people asking for the feature and how easy is it to implement.I already know this would take considerable resources to add to VW's, so that means a lot of people need to ask for this feature for it to have a hope in hell. So, if anyone out there feels they need this feature please speak up and post your two cents. Show NNA there is a need for this feature. Dave
  9. Gordon, Here's a quick modification of your scriptto show reading each line. VS automaticallyresets and starts at the BOF for you.HTHDave PROCEDURE A_test;CONSTfilespec ='The output';VARa1,a2,a3,a4,a5,a6,a7,a8 :REAL;b1,b2,b3,b4,b5,b6,b7,b8 :REAL; BEGINa1 := 1.1;a2 := 2.2;a3 := 3.3;a4 := 4.4;a5 := 5.5;a6 := 6.6;a7 := 7.7;a8 := 8.8;Rewrite(filespec);WriteLn(a1);WriteLn(a2);WriteLn(a3);WriteLn(a4);WriteLn(a5);WriteLn(a6);WriteLn(a7);WriteLn(a8);Close(filespec); Open(filespec);WHILE NOT EOF(filespec) DOBEGIN StdRead(b1,b2,b3,b4,b5,b6,b7,b8); Close(filespec); Message(b1,' ',b2,' ',b3,' ',b4,' ',b5,' ',b6,' ',b7,' ',b8); Wait (3); Clrmessage;END;END;RUN(A_test); [ 04-22-2002: Message edited by: Fuge ]
  10. Try This----------------DSelectAll; SelectObj(('TextRecord'.'TextField'='01' ));{ Select objects with 01 only }----------------- Make sure your objects are not groupedand are on the active layer or the script will not select the objects The syntax above is correct Dave [ 04-17-2002: Message edited by: Fuge ]
  11. Sorry to say, but beyond what vectorscript can do. Vectorscript does not give you the ability toauto - name and save files, much less set pre-defined parameters to export files by. If were extremely lucky maybe the next version of Vectorworks might allow us to do some batching with vectorscript. Dave
  12. Mark, Thanks for the fix. You should ask for a desk up front. Dave
  13. Can you guys add a GetProjection(); call to vectorscript to go along with SetProjection(); There's currently no way to determine whethera user is in Top or Top/Plan view. When writing scripts that convert to lines that's important to know. ThanksDave
  14. Chrissy, VectorWorks has 2 applescript commands"Do Script" , for running a vectorscript and "translate" . Translate is suppose to open an older document and translate it to the new version and save it under a new name. Nowwhether it will convert a MC7 document I'm not sure. There's an applescript that converts MC6 files to MC7 here.http://www.nemetschek.net/downloads/MC7/mcupdates.htmlYou could probably update that script for your needs if your lucky. Dave
  15. You can write something to print multiple layers or sheets within the active document, BUT you have to be willing to hit the "OK" button everytime the print dialog appears, which is really not very desirable. You cannot print mulitple files however,or batch files to save them as DWG files. It would be nice to see vectorscript reachoutside the active document and allowscriptors to suppress print and other dialogs.Something like what Filemaker does would be a step in the right direction. If your intent is to print drawings within adocument, let me know more exact what you what to do, I'll be glad to help you out. Dave
  16. Check out this link. It's Print2PDF forWindows. http://www.software602.com/products/printpack/pdf.html Dave
  17. I don't have a solution for you , but I can confirm what your seeing, because I've seen it as well. I've tried everything to work around it without any luck. It does seem that after a certain number of classes the sub-menusjust stop getting formatted correctly. Dave
  18. The vectorscript Editor is part of Vectorworks 8.5, however as your seeing it can only handlea script up to 32k in size on Mac. You would also need to edit plug-ins throught the "Create Plug-in..." menu. Find a friend with Vectorworks 8.5 on windows. VectorWorks 8.5 on windows can edit vectorscripts up to 64k. Vectorworks 9.x no longer has this vectorscript size limitation on either platform.An upgrade may be your best bet. HTHDave
  19. Lonnie, Most likely when you did a copy and pasteto grab the script you may have either missedpart of the script or there may be a hiddencharacter that is causing the script not to run.One tiny thing being off will cause a problem. That's my best guess.Dave
  20. If your expecting the tool to work as a button,do something simply by clicking on it, it's currently not do-able. Tools requires anaction by the user, like clicking on an object or down on the screen, etc.. Dave
  21. Yes Dave---------------Procedure Showallclasses;VAR numberofclasses,ClassIndex:LONGINT;ClassVisibility:INTEGER;ClassName:STRING; BEGIN numberofclasses:=ClassNum; ClassIndex:=0; FOR ClassIndex := 1 TO numberofclasses DO BEGIN ClassName:= ClassList( ClassIndex ); ClassVisibility:= GetCVis( ClassName ); IF ClassVisibility = -1 THEN BEGIN ShowClass( ClassName ); END; END; END;RUN ( Showallclasses );
  22. Give this a try.Dave Procedure ClassPick;{Does not hide the none class}VAR pX, pY:REAL; obj:HANDLE; classname:STRING; BEGIN GetPt(pX, pY); obj:= PickObject(pX, pY); SetSelect(obj); classname:= GetClass(obj); HideClass(classname); END;RUN (ClassPick);
  23. Heather, Name your worksheet,it's size and distance from the drawing area inthe CONST section and your good to go.Dave -------------------------------------------PROCEDURE WS;CONST WksName = 'My_WS_Name'; {Your worksheet name} Top =1; {Worksheet Top} Left=1; {Worksheet Left} Bottom=2; {Worksheet Bottom} Right=2; {Worksheet Right} WSPositionX=1"; { X Distance from drawing area } WSPositionY=1"; { Y Distance from drawing area }VAR WksH,WSImage : HANDLE; ws1X, ws1Y, ws2X, ws2Y ,d1X, d1Y, d2X, d2Y :REAL; BEGIN WksH := Getobject ( WksName ); ShowWS(WksH,True); SetWSPlacement(WksH,Top,Left,Bottom,Right); RecalculateWS(WksH); ShowWS(WksH,False); WSImage:=GetWSImage(WksH); GetBBox(WSImage,ws1X, ws1Y, ws2X, ws2Y ); GetDrawingSizeRect(d1X, d1Y, d2X, d2Y ); HMove(WSImage,(d2X - ws2X) - WSPositionX, ( d2Y - ws2Y ) + WSPositionY ); END;RUN ( WS ); [ 02-13-2002: Message edited by: Fuge ]
  24. This should do what you want. Keep in mind that this script will work in VW8.5 but would need to be slightly changed for VW9.Dave---------------------------------------------PROCEDURE WSexport;LABEL 99;CONST WksName = 'export'; {The Worksheets name}VAR WksH : HANDLE; BEGIN WksH := Getobject ( WksName );{Checks if the worksheet exists by name} IF WksH = NIL THEN BEGIN Sysbeep; AlrtDialog ( 'The export worksheet does not exist in this document!' ); GOTO 99; END; SelectSS ( WksH ); DoMenuText ( 'WSRecalculate' ); DoMenuTextByName ( 'Export Worksheet' , 0 ); 99 : END;RUN ( WSexport );
  25. Are the window symbols your using allhave the exact same record fields? I might be able to modify the script I have to fityour needs. It may be a few days before I could work on it... Dave
×
×
  • Create New...