Jump to content

kiwi

Member
  • Posts

    104
  • Joined

  • Last visited

    Never

Everything posted by kiwi

  1. You can first try your scripts using {$debug}. If you get a loop, just stop the execution... and you can see where and why you get stuck! I use BBedit temples that always include {debug}, I just need to ad or remove the '$' Esc seems to work OK as long you don't touch another key before.
  2. he...he! I spend a couple of min modifying one of my classics... dedicate to you Balemi (note that I'm not sure the rest of the script works... I just tested the dialogs). You see the final dialog being in function of the first selection... I hope that's what you was after. Good luck to see the variables... but the one you are after is the BalemiIndex, that runs one of the two Define or drive procedures. They are probably more elegant ways to do that... but he works! I never done a PIO, and is little I can help with those. code: {/////////////////////////////////////////////////////////////// LayerClassT By: <Kiwi Dec 2003> For: <Balemi> Built with Dialog Builder 4 © 2001 Nemetschek North America. ///////////////////////////////////////////////////////////////} PROCEDURE LayerClassT; VAR dlogID,dlogResult,nl,nc,i : INTEGER; dialogIsOK,rsrcOK,dupl,go,dumm,OK, BalemiIndex : BOOLEAN; h,ho: HANDLE; Layerr,classr,currentL,currentC: STRING; Layers,Classes: DYNARRAY OF STRING; { dialog related subroutines } { Dialog definition function subroutine } FUNCTION Define_LayerClassT1 : INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('Layer/Class Transfer',True,'OK','Cancel'); CreatePulldownMenu(dialogID,10,25); CreateCheckBox(dialogID,30,'Follow objects'); CreateCheckBox(dialogID,40,'duplicate objects'); SetFirstLayoutItem(dialogID,10); SetBelowItem(dialogID,10,30,0,0); SetBelowItem(dialogID,30,40,0,0); SetHelpString(1,'Accepts dialog data.'); SetHelpString(2,'Cancels operation without changes.'); SetHelpString(10,'Slect a layer to transfer your selected object'); SetHelpString(30,'Go to the selected option with the actual visibility settings'); SetHelpString(40,'Select to duplicate your selected object'); Define_LayerClassT1 := dialogID; END; FUNCTION Define_LayerClassT2 : INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('Layer/Class Transfer',True,'OK','Cancel'); CreatePulldownMenu(dialogID,20,25); CreateCheckBox(dialogID,30,'Follow objects'); CreateCheckBox(dialogID,40,'duplicate objects'); SetFirstLayoutItem(dialogID,20); SetBelowItem(dialogID,20,30,0,0); SetBelowItem(dialogID,30,40,0,0); SetHelpString(1,'Accepts dialog data.'); SetHelpString(2,'Cancels operation without changes.'); SetHelpString(20,'Select the class you want your object transfer to.'); SetHelpString(30,'Go to the selected option with the actual visibility settings'); SetHelpString(40,'Select to duplicate your selected object'); Define_LayerClassT2 := dialogID; END; { get Layer names to dinarray Layers } Procedure GetLayers; BEGIN nl:=NumLayers; AlLOCATE Layers[1..nl]; h:=FLayer; For i:=1 TO nl DO BEGIN Layers:=GetLNAME(h); h:=NextLAyer(h); END; END; { get Class names to dinarray Classes } Procedure GetClasses; BEGIN nc:=ClassNum; AlLOCATE Classes[1..nc]; For i:=1 TO nc DO BEGIN Classes:=ClassList(i); END; END; { Change each obj settings } Procedure ChangeObject(ho:HANDLE); BEGIN h:=GetLayerByName(layerr); SetClass(ho,classr); dumm:=SetParent(ho,h); END; { Dialog driver function subroutine 1 } PROCEDURE Drive_LayerClassT1(VAR item:LONGINT; data:LONGINT); BEGIN CASE item OF SetupDialogC:BEGIN GetLayers; h:=ActLayer; CurrentL:=GetLNAme(h); FOR i:=1 to nl DO BEGIN InsertChoice(10,i-1,Layers); IF Layers=CurrentL THEN SELChoice(10,i,true); END; OK:=TRUE; END; 1:BEGIN GetSelChoice(10,0,i,Layerr); dupl:=ItemSel(40); go:=ItemSel(30); END; END; END; { Dialog driver function subroutine 2 } PROCEDURE Drive_LayerClassT2(VAR item:LONGINT; data:LONGINT); BEGIN CASE item OF SetupDialogC:BEGIN GetClasses; CurrentC:=ActiveClass; For i:=1 TO nc DO BEGIN InsertChoice(20,i-1,Classes); IF ClassList(i)=CurrentC THEN BEGIN SELChoice(20,i,true); END; END; OK:=TRUE; END; 1:BEGIN GetSelChoice(20,0,i,Classr); dupl:=ItemSel(40); go:=ItemSel(30); END; END; END; { main body of script } BEGIN BalemiIndex:= YNDialog ('Yes: layers, No: classes'); If BalemiIndex THEN dlogID := Define_LayerClassT1 ELSE dlogID := Define_LayerClassT2; dialogIsOK := VerifyLayout(dlogID); IF dialogIsOK THEN BEGIN If BalemiIndex THEN dlogResult:= RunLayoutDialog(dlogID,Drive_LayerClassT1); If NOT BalemiIndex THEN dlogResult:= RunLayoutDialog(dlogID,Drive_LayerClassT2); END; IF dupl THEN duplicate(0,0); IF OK THEN ForEachObject(ChangeObject,SEL=true); IF go THEN BEGIN NameClass(Classr); Layer(layerr); END ELSE BEGIN Layer(CurrentL); NameClass(CurrentC); END; END; Run(LayerClassT); [/code]
  3. Hi Balemi.... Busy lately, and not with what you was thinking! You may want to set different dialog sub ruttiness and call them from the main one. A bit like sub dialogs... I never try that, but the manual says is possible! You can call a small subdialog, or a function like GetInteger() when you set your "run dialog" procedure and set your dialog menus in function your integer. Your SetEditReal only work when you set your dialog, but nothing stop you to have a diferent set dialog procedures, and call the one you need when before run your dialog and set the display values: this could be the best option for you. Will work a bit this one on the next days and try to come up with an example. Cheers,
  4. Are you testing your objects with" GetTipe(h): INTEGER" ? A script doesen't take that long to ungroup, test all your objects (sub ungroup if needed!), and group them again.
  5. I will guess the VW color palette is a resource file. You must then track the file and use it on the interface. You could as well create your own resource file and then your own color palette (a second dialog): he shouldn't be so hard... is just a series of numbers corresponding to RGB values. A old tread that talking about colors (RGB dialog): http://techboard.nemetschek.net/ubb/ultimatebb.php?ubb=get_topic;f=20;t=000997 About the resources files: http://techboard.nemetschek.net/ubb/ultimatebb.php?ubb=get_topic;f=21;t=000239 http://techboard.nemetschek.net/cgi/ubb/ultimatebb.cgi?ubb=get_topic;f=21;t=000011 http://techboard.nemetschek.net/cgi/ubb/ultimatebb.cgi?ubb=get_topic;f=21;t=000128 Not a real answer, but he may help!
  6. Yeah!... I get the dialog builder ( http://www.nemetschek.net/support/custom/vscript/vstool.html ), had a look on http://www.nemetschek.net/support/custom/vscript/example.html .... and take a couple of tranquilizers! Once you get over the first stage is quite easy to get good interfaces... well until you try to use resource files! but for the normal stuff is not so bad. You will have a series of procedures (at least two): -The dialog declaration, where you build your interface ( Define-YourDialog). -The behavior of the dialog when you call it (Drive-YourDialog). -Then will came your script (BEGIN-END;) where you call the procedures for the dialog I post a couple of scripts using dialogs: http://techboard.nemetschek.net/cgi/ubb/ultimatebb.cgi?ubb=get_topic;f=20;t=000997 http://techboard.nemetschek.net/cgi/ubb/ultimatebb.cgi?ubb=get_topic;f=21;t=000233 They use the same basic interface develop on Dialog Builder, where you can keep adding stuff or calling another procedures to get the needed data.
  7. For some reason I can only set VS as encrypt plugins for macs from a mac and for windows from a windows... Is annoying since I need to be mocking around with the source code instead send strait away a encrypt copy of the plugin from my mac to both platforms. As anyone the same problem... or a solution? Thanks, Dual 1.2 768mb on 10.3.2 WV 10.5.1
  8. Interesting... If you check the use of the processor while the VS editor is open, you will see that he's trying to run a 100%. Not that handy when running renderings (not VW) on the background, or is summer and all the fans keep turning on with out apparent reason... just some realy basic text! If someone could come with a way to compile the code in BBEdit... or convince the NNA that we need a dam good VS editor upgrade!
  9. I just update the VS language module for BBedit to 10.5.1. I can send it via e-mail to anyone that need it.
  10. I work in 10.5.1 on a OSX 10.3 and the problem of the double click still mess up the results of the getPtL function. Force the object to have his geometry recalculate, then redraw helps, but doesn't change the fact that he seems to be a bug.
  11. In VW go to Organize/Scripts/Create Plugin. One of the options is to create a menu command where you will be able to insert (copy in your normal editor, and paste in the plugin editor) the VS code. You then need to edit you workspace to proudly feature your new and shiny command.
  12. I'm not sure why the artifact, but is just a visual one: try to zoom out or in too see it disappear. A RedrawAll at the end of the script should help too. but the last line seems to have another artifact: a kind of "hole". If you click a bit so fast to end the last line, VS get a double click and he seems that GetPtL get a problem with that! I send you another version of the same script from another point of view, and where the lines are force to be redraw by reseting the Bbox. We still get an artifact (??) when using GetPtL, but once the end click, the drawing looks OK. Could be easier to draw a poly and then transform to lines using a couple of shortcuts! code: Procedure WireTool; VAR pt1,pt2 : POINT; o: BOOLEAN; BEGIN DSelectAll; GetPt(pt1.x,pt1.y); MoveTo(pt1.x,pt1.y); WHILE NOT o DO BEGIN GetPtL(pt1.x,pt1.y,pt2.x,pt2.y); o:=(pt1=pt2); IF NOT o THEN BEGIN LineTo(pt2.x,pt2.y); ResetObject(LNewObj); Redraw; SetDSelect(LNewObj); END; pt1:=pt2; END; RedrawAll; END; Run(WireTool);[/code]
  13. You are able to display and modify any information related to any object on your drawing with VS. Dialog Builder can develop a custom dialog interface to use on your script. Thanks to the ability to create plugins and assign them short cuts, you could call your info on a key board stroke, and use the tabs to surf through: no mousing! I use the records to store non OIP info and be able to use it on scripts, and is working well. Under the "Database/Record" VS class you will found 13 procedures giving you full access to the record formats.
  14. He works the same way that on the 3D pack tool. You need to create a group and include on it your handles: the handle to the group is your first parameter... The 3 booleans correspond to the options, rule the surface, close the surface, a solid surface (see reference for more help). Something like: DSelectAll; SetSelected(h1); SetSelected(h2); Group; h:=LNewObject; h:=CreateLoftSurfaces(h,true,false,false); They are many ways to create a group, but the order is important( surface: h1 to h2 to h3...). Sometimes the results are not the expected, and play with the direction of the curves helps. Remember to recalculate the BBox for your surfaceand Redraw.
  15. kiwi

    Get2DPt

    I leave your code almost intact, just add a putfile() to make easier for me to test the script, and a close() to close the txt file. the text outputfile (for two triangles, one selected)t: Layer = Layer-1 has 2 objects First selected symbol has 3 vertices vertex 1 : x = -655, y = -805 vertex 2 : x = -1025, y = -2235 vertex 3 : x = 285, y = -1945 And he looks right to me, I'm not sure if the glitch is on your version of VW... the only way I can see is you send me the file and I will try to work that out: is quite interesting and maybe our moderator could say more than me about what's going wrong. This code write a file defining any kind of object out, in or over the edge of the drawing, I'm not sure if he will work on older versions of VW (10.5), but he may give you the main idea for find objects out of the drawing boundaries. You could add any kind of identification for each object. text file (for 4 objects): Layer = Layer-1 has 4 objects object over object in object out object out code: Procedure Fozz; VAR s :REAL; pd1,pd2: POINT; filename : string; layerh : handle; Procedure InclObj(h:HANDLE); VAR p1,p2: POINT; o,u: BOOLEAN; BEGIN GetBBox(h,p1.x,p1.y,p2.x,p2.y); o:=PtInRect(p1.x,p1.y,pd1.x,pd1.y,pd2.x,pd2.y); u:=PtInRect(p2.x,p2.y,pd1.x,pd1.y,pd2.x,pd2.y); IF u & o THEN writeln('object in'); IF (NOT u) & (NOT o) THEN writeln('object out'); IF u & (NOT o) THEN writeln('object over'); IF (NOT u) & o THEN writeln('object over'); END; {main} BEGIN PutFile('fileto write','none',Filename); layerh := ActLayer; s:=GetLScale(Layerh); GetDrawingSizeRect(pd1.x,pd1.y,pd2.x,pd2.y); writeln ( 'Layer = ', GetLname(layerh), ' has ', NumObj(layerh), ' objects' ); ForEachObject(InclObj,SEL=True); Close(Filename); END; Run (Fozz); [/code]
  16. kiwi

    Get2DPt

    That may help: code: Procedure Fozz; VAR x,y :REAL; h: HANDLE; n,i: INTEGER; BEGIN h:=FSActLayer; n:=getVertNum(h); FOR i:=1 TO n DO BEGIN Get2DPt(h,i,x,y); Locus(x,y); END; END; Run (Fozz);[/code]
  17. After reset the box you need to redraw it, and is straight on.... Have a look on the script I post in here: http://techboard.nemetschek.net/ubb/ultimatebb.php?ubb=get_topic;f=20;t=000997 , you can see at the end (L 126) the call to ResetBBox(h);Redraw; Hey Balemy, you are in NZ... need to get for a beer one of this days. Sad for the All Blacks and the America's cup is gone too: but they will never get Speight's!
  18. kiwi

    Get2DPt

    I use heavily the Get2DPoint(), and a few workstations run the scripts all day long with out any problems. Is good to use the debug, and he will show you if the handle or the index have any kind of problem (like NIL), and where from come your x and y values. Sometimes, if I'm not sure if the script goes to find a handle to get get a read, I place a IF h<> NIL THEN Procedure() ELSE Procedure() The procedures carry a boolean that will tell me if anything went wrong. You could try your script on a poly using GetPolyPt(h,i,x,y), and if he doesn't work is definitively something with your script. You can post a sample of the code and we have a look at it: is always a good way to solve thinks fast and create a learning curve for everybody. JKoppi, is good to know you are around.
  19. No idea about windows, but the main classes that handle code in cocoa (the framework where the applications run) set the way the scrolling behave. Is quite handy: when you program something with a windows you don't need to add any code for thinks like scrolling or copy and paste... is what they call inherence, and our main Superclass NSobject (in objectiveC) and NSwindows describe all that. You can see on OSX that must of the apps behave the same way, side scrolling holding "shift" or zoom with "control" in drawing windows, even with the very few lines of code you need to display a "Hello World" on a drawing window... Is not a excuse, you can overwrite any aspect of a super class. But I would guess that if we want all the windows (like layers menu, plugins and others) updated, is the fastest way to go. I still remember the first OSX versions with out scrolling on the main window! I will just say again: thanks very much for the outstanding work you are doing...
  20. Yes, nothing easier... you just need to get me the VW source code and I make the modification for you! Sorry: Is the only way I can think of... But maybe somebody else is a bit less "funny" and more able to help you.
  21. I use dialog builder 4.0b4: the plugins work find on 10.5, just drop them on the plugins folder, and set the workspace. The debugger tells you if anything is not right, and on this case the procedures reading layers and classes work find (you can see the strings being assign), then could only be something related to the pull down menus and the way I assign the sting values. This debugger is a wonderful think. Let's hope we will have soon a real script editor with colors, scrolling and enable us to work with too or more scripts open (like BBedit but with compile and debug).
  22. I'm not sure if is any way to give you a perfect solution to what your request, but this old script of mine may at least help you. He will tell you the RGB values, and you are able to edit them. You still need to select the object, and then run the script as a contextual menu plugin, or just set it with a keyboard shortcut. If you only work with the colors on the palette, instead of the RGB values you may better use the index values of the palette: easier to remember. The script is easy to modify... code: {/////////////////////////////////////////////////////////////// By: Kiwi 2002 Built with Dialog Builder 4 © 2001 Nemetschek North America. ///////////////////////////////////////////////////////////////} PROCEDURE GetCol; VAR dlogID,dlogResult : INTEGER; dialogIsOK,rsrcOK : BOOLEAN; r,g,b,rr,gg,bb : LONGINT; rs,gs,bs,rrs,ggs,bbs: STRING; h : HANDLE; o : BOOLEAN; FUNCTION Define_GetCol : INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('User Info',False,'OK','Cancel'); CreateGroupBox(dialogID,5,'Pen Fore',true); CreateGroupBox(dialogID,6,'Fill Back',true); CreateStaticText(dialogID,10,'R:',-1); CreateEditInteger(dialogID,11,0,8); CreateStaticText(dialogID,20,'G:',-1); CreateEditInteger(dialogID,21,0,8); CreateStaticText(dialogID,30,'B:',-1); CreateEditInteger(dialogID,31,0,8); CreateStaticText(dialogID,100,'R:',-1); CreateEditInteger(dialogID,110,0,8); CreateStaticText(dialogID,200,'G:',-1); CreateEditInteger(dialogID,210,0,8); CreateStaticText(dialogID,300,'B:',-1); CreateEditInteger(dialogID,310,0,8); SetFirstLayoutItem(dialogID,5); SetFirstGroupItem(dialogID,5,10); SetRightItem(dialogID,10,11,0,0); SetBelowItem(dialogID,10,20,0,0); SetRightItem(dialogID,20,21,0,0); SetBelowItem(dialogID,20,30,0,0); SetRightItem(dialogID,30,31,0,0); AlignItemEdge(dialogID,10,1,29,1); AlignItemEdge(dialogID,20,1,29,1); AlignItemEdge(dialogID,30,1,29,1); AlignItemEdge(dialogID,11,3,25,1); AlignItemEdge(dialogID,21,3,25,1); AlignItemEdge(dialogID,31,3,25,1); SetRightItem(dialogID,5,6,0,0); SetFirstGroupItem(dialogID,6,100); SetRightItem(dialogID,100,110,0,0); SetBelowItem(dialogID,100,200,0,0); SetRightItem(dialogID,200,210,0,0); SetBelowItem(dialogID,200,300,0,0); SetRightItem(dialogID,300,310,0,0); AlignItemEdge(dialogID,100,1,290,1); AlignItemEdge(dialogID,200,1,290,1); AlignItemEdge(dialogID,300,1,290,1); AlignItemEdge(dialogID,110,3,250,1); AlignItemEdge(dialogID,210,3,250,1); AlignItemEdge(dialogID,310,3,250,1); Define_GetCol := dialogID; END; PROCEDURE Drive_GetCol(VAR item:LONGINT; data:LONGINT); BEGIN CASE item OF SetupDialogC:BEGIN h:=FSActLayer; GetPenFore(h,r,g,b); GetFillBack(h,rr,gg,bb); SetField(11,Num2Str(0,r)); SetField(21,Num2Str(0,g)); SetField(31,Num2Str(0,b)); SetField(110,Num2Str(0,rr)); SetField(210,Num2Str(0,gg)); SetField(310,Num2Str(0,bb)); END; 1:BEGIN o:=True; rs:=getField(11); gs:=getField(21); bs:=getField(31); rrs:=getField(110); ggs:=getField(210); bbs:=getField(310); END; 2:BEGIN o:=false; END; END; END; BEGIN dlogID := Define_GetCol; dialogIsOK := VerifyLayout(dlogID); IF dialogIsOK THEN BEGIN dlogResult := RunLayoutDialog(dlogID,Drive_GetCol); END; IF o THEN BEGIN SetPenFore(h,Str2Num(rs),Str2Num(gs),Str2Num(bs)); SetFillBack(h,Str2Num(rrs),Str2Num(ggs),Str2Num(bbs)); ResetBBox(h); Redraw; END; END; Run(GetCol);[/code]
  23. If you are working on 3d layers you will not be able to snap across layers (page 3-11 VW 10 manual), then if any of your 2D obj is in another 3D layer you will not be able to do anything via the cursor. Drawing objects like nurbs or using some plugins could set unexpectedly the current layer as 3D : as say above get back on Top/plan (press command+5)
  24. A user post report a bug affecting similar script running under Windows. I found a problem on the indexing for the pul down menus (the fist value need to be 0 and not 1): as result you can not see the layers or classes to make a choice. To fix the issue replace: Line 127 with: InsertChoice(10,i-1,Layers); Line 134 with: InsertChoice(20,i-1,Classes);
  25. Got it! The assign integer for the pull down menus start at 0 and not at 1... for some reason on a mac still work, but not on a XP. once modify he looks like: Hope is find now.... code: {/////////////////////////////////////////////////////////////// LayerClassT By: <Kiwi Dec 2003> Built with Dialog Builder 4 © 2001 Nemetschek North America. ///////////////////////////////////////////////////////////////} PROCEDURE LayerClassT; VAR dlogID,dlogResult,nl,nc,i : INTEGER; dialogIsOK,rsrcOK,dupl,go,dumm,OK : BOOLEAN; h,ho: HANDLE; Layerr,classr,currentL,currentC: STRING; Layers,Classes: DYNARRAY OF STRING; { dialog related subroutines } { Dialog definition function subroutine } FUNCTION Define_LayerClassT : INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('Layer/Class Transfer',True,'OK','Cancel'); CreatePulldownMenu(dialogID,10,25); CreatePulldownMenu(dialogID,20,25); CreateCheckBox(dialogID,30,'Follow objects'); CreateCheckBox(dialogID,40,'duplicate objects'); SetFirstLayoutItem(dialogID,10); SetBelowItem(dialogID,10,20,0,0); SetBelowItem(dialogID,20,30,0,0); SetBelowItem(dialogID,30,40,0,0); SetHelpString(1,'Accepts dialog data.'); SetHelpString(2,'Cancels operation without changes.'); SetHelpString(10,'Slect a layer to transfer your selected object'); SetHelpString(20,'Select the class you want your object transfer to.'); SetHelpString(30,'Go to the selected option with the actual visibility settings'); SetHelpString(40,'Select to duplicate your selected object'); Define_LayerClassT := dialogID; END; { get Layer names to dinarray Layers } Procedure GetLayers; BEGIN nl:=NumLayers; AlLOCATE Layers[1..nl]; h:=FLayer; For i:=1 TO nl DO BEGIN Layers:=GetLNAME(h); h:=NextLAyer(h); END; END; { get Class names to dinarray Classes } Procedure GetClasses; BEGIN nc:=ClassNum; AlLOCATE Classes[1..nc]; For i:=1 TO nc DO BEGIN Classes:=ClassList(i); END; END; { Change each obj settings } Procedure ChangeObject(ho:HANDLE); BEGIN h:=GetLayerByName(layerr); SetClass(ho,classr); dumm:=SetParent(ho,h); END; { Dialog driver function subroutine } PROCEDURE Drive_LayerClassT(VAR item:LONGINT; data:LONGINT); BEGIN CASE item OF SetupDialogC:BEGIN GetLayers; h:=ActLayer; CurrentL:=GetLNAme(h); FOR i:=1 to nl DO BEGIN InsertChoice(10,i-1,Layers); IF Layers=CurrentL THEN SELChoice(10,i,true); END; GetClasses; CurrentC:=ActiveClass; For i:=1 TO nc DO BEGIN InsertChoice(20,i-1,Classes); IF ClassList(i)=CurrentC THEN BEGIN SELChoice(20,i,true); END; END; OK:=TRUE; END; 1:BEGIN GetSelChoice(20,0,i,Classr); GetSelChoice(10,0,i,Layerr); dupl:=ItemSel(40); go:=ItemSel(30); END; END; END; { main body of script } BEGIN dlogID := Define_LayerClassT; dialogIsOK := VerifyLayout(dlogID); IF dialogIsOK THEN BEGIN dlogResult := RunLayoutDialog(dlogID,Drive_LayerClassT); END; IF dupl THEN duplicate(0,0); IF OK THEN ForEachObject(ChangeObject,SEL=true); IF go THEN BEGIN NameClass(Classr); Layer(layerr); END ELSE BEGIN Layer(CurrentL); NameClass(CurrentC); END; END; Run(LayerClassT); [/code]
×
×
  • Create New...