Jump to content

MullinRJ

Member
  • Posts

    2,020
  • Joined

  • Last visited

Posts posted by MullinRJ

  1. Press the "A" key twice fast, or double-click on the Snap-To-Grid constraint button and the "Set Grid" dialog box will appear. Set the Grid Options the way you like.

    If Show Grid Lines is on and you zoom way out the blue grid will disappear. They will reappear when you zoom back in.

    I am not sure what you mean by "accurate polylines", but setting the constraints is key to drawing precisely. It is possible to change constraints as you add vertices to a polyline so memorizing the keyboard shortcuts to the constraints is also very important to being able to draw quickly and with confidence.

    Write back if you have more questions.

    HTH,

    Raymond

  2. I have Cmd-Opt-1 set to UNLOCK and Cmd-Opt-2 set to LOCK, so I know you can assign those keystrokes in VW. This works on my G4 and MacMini, and I've been doing it since VW10.

    If you open and close the Workspace Editor without making any changes do you still get the message? If so, there is a conflict in your workspace hidden somewhere. I'd start looking in the EDIT menu and see how you have the Copy command assigned. If it looks normal, then check every other menu looking for a Cmd-C. If you find it, remove it and save your Workspace. Then open it again and start over.

    One of the neatest thing I like about using Cmd-Opt-1&2 is that they only Unlock and Lock when objects are selected. With nothing selected they still Zoom In & Out x4. A very nice side effect. May it never change.

    HTH,

    Raymond

    VW 12.5.0 DRW/ MacMini / 10.4.8

  3. Here's the same Modern Dialog example as the one posted above with EVERY-UNNECESSARY-THING stripped out, except the comments. Gotta have comments.

    HTH,

    Raymond

    PROCEDURE Minimal3itemDialog;
    { 23 February 2007 - ?2007 Raymond Mullin. All rights reserved. }
    { Create a skeletal Modern Dialog with 3 text fields and nothing else. This is bare bones, no frills code. }
    VAR
    dlogID, dlogResult :Longint;
    X, Y, Q :Real;			{ These variables will hold the answers after the dialog closes. }
    
    
    procedure DialogDriver(var item: Longint; data :Longint);
    { This routine is called by the Modern Dialog each time your dialog receives an event - type a character, delete or paste text, }
    { click on or tab into a new field, click on a control. The dialog manager quits when you exit this procedure and ITEM equals 1. }
    { When this routine exits any other value for ITEM, the dialog manager waits for another event. }
    Begin
    	case item of
    		1: begin		{ OK was pressed, collect all data from dialog and get ready to exit. }
    			X := Str2Num(GetField(21));		{ Move first value to X }
    			Y := Str2Num(GetField(22));		{ Move second value to Y }
    			Q := Str2Num(GetField(23));		{ Move third value to Q }
    		end;
    		23: SYSBEEP;					{ Third field - BEEP -  Just for grins }
    	end;		{ case }
    End;		{ DialogDriver }
    
    
    BEGIN
    { *** Section 1 - Create items *** }
    dlogID := CreateLayout('No Frills Dialog', False, 'OK', '');		{ create dialog window and ID }
    
    { define 3 TextEdit fields }
    CreateEditText(dlogID, 21, '', 16);			{ X }
    CreateEditText(dlogID, 22, '', 16);			{ Y }
    CreateEditText(dlogID, 23, '', 16);			{ Q }
    
    { *** Section 2 - Place items *** }
    SetFirstLayoutItem(dlogID, 21);			{ First item - always goes in upper left corner }
    SetBelowItem(dlogID, 21, 22, 0, 0);		{ Y - place below X field. }
    SetBelowItem(dlogID, 22, 23, 0, 0);		{ Q - place below Y field. }
    
    { *** Run the dialog *** }
    dlogResult := RunLayoutDialog(dlogID, DialogDriver);
    
    { *** Harvest the results *** }
    if (dlogResult = 1) then			{ 1 means OK button was pressed. }
    	message('X = ', X, '   Y = ', Y, '    Q = ', Q);		{ display values in the MESSAGE window when program completes. }
    END;		{ Minimal3itemDialog }
    Run (Minimal3itemDialog);

  4. Hi vsd,

    Ask and you shall receive. This is a "simple" do-nothing dialog that accepts 3 numbers and displays them in a MESSAGE when finished. There is a little error detection employed and all the i's are dotted and the t's crossed.

    See the next post for a truly minimal approach at doing the very least. I don't recommend living this way, but it does show what makes things tick.

    Raymond

    PROCEDURE Sample3itemDialog;
    { 23 February 2007 - ?2007 Raymond Mullin. All rights reserved. }
    { Create a Modern Dialog with 3 text fields and a little error checking. }
    VAR
    dlogID, dlogResult :Longint;
    X, Y, Q :Real;					{ These variables will hold the answers after the dialog closes. }
    
    
    function DefineDialog(DName :String) :Longint;
    { Define the structure of the dialog and return an ID to reference it. This does not draw the dialog on the screen. }
    { there are 4 sections for defining a Modern Dialog - Create items, Place items, Align items, & Define Help for items. }
    
    Var
    	dlogID :Longint;
    Begin
    	{ *** Section 1 - Create items *** }
    	dlogID := CreateLayout(DName, True, 'OK', 'Cancel');	{ create dialog window and ID }
    
    	{ define the labels for the TextEdit fields }
    	CreateStaticText(dlogID, 11, 'X:', 2);	{ Creates first item, but does not place it in dialog }
    	CreateStaticText(dlogID, 12, 'Y:', 2);	{ Creates second item ... }
    	CreateStaticText(dlogID, 13, 'Q:', 2);	{ Creates third item ... }
    
    	{ define the TextEdit fields }
    	CreateEditText(dlogID, 21, '', 16);		{ X }
    	CreateEditText(dlogID, 22, '', 16);		{ Y }
    	CreateEditText(dlogID, 23, '', 16);		{ Q }
    
    
    	{ *** Section 2 - Place items *** }
    	{ Label for TextEdit fields }
    	{ First item - always goes in upper left corner. }
    	SetFirstLayoutItem(dlogID, 11);		{ X: }
    	SetBelowItem(dlogID, 11, 12, 0, 0);	{ Y: }
    	SetBelowItem(dlogID, 12, 13, 0, 0);	{ Q: }
    
    	{ Text Edit Fields }
    	SetRightItem(dlogID, 11, 21, 0, 0);		{ X - place to right of X: label. }
    	SetRightItem(dlogID, 12, 22, 0, 0);		{ Y - place to right of Y: label. }
    	SetRightItem(dlogID, 13, 23, 0, 0);		{ Q - place to right of Q: label. }
    
    
    	{ *** Section 3 - Align items *** }
    	AlignItemEdge(dlogID, 21, 3, 1, 0);		{ X }
    	AlignItemEdge(dlogID, 22, 3, 1, 0);		{ Y }
    	AlignItemEdge(dlogID, 23, 3, 1, 0);		{ Q }
    
    
    	{ *** Section 4 - Define Help strings *** }
    	{ Help strings are not needed - but don't leave home without them. Meaning - always include them. }
    	SetHelpString(0, 'This will display when the cursor is in the dialog window, but not over any dialog item.');		{ undocumented, but nice to know }
    
    	SetHelpString(1, 'Click this button to ACCEPT dialog settings.');						{ help string for OK button }
    	SetHelpString(2, 'Click the button, or press ESC key, to CANCEL dialog and do nothing.');		{ help string for CANCEL button }
    
    	SetHelpString(21, 'Help for your first item - X.');		{ item specific help strings. Must be less than 256 characters. }
    	SetHelpString(22, 'Help for your second item - Y.');
    	SetHelpString(23, 'Ignore the noise.');
    
    	DefineDialog := dlogID;			{ return the ID when you exit this routine. }
    End;		{ DefineDialog }
    
    
    
    procedure DialogDriver(var item: Longint; data :Longint);
    { This routine is called by the Modern Dialog each time your dialog receives an event - type a character, delete or paste text, }
    { click on or tab into a new field, click on a control. The dialog manager quits when you exit this procedure and ITEM equals 1 or 2. }
    { When this routine exits any other value for ITEM, the dialog manager waits for another event. }
    Begin
    	case item of
    		SetupDialogC: begin
    				{ Do all setup here. Initialize variables, set controls, etc.}
    				{ This item runs ONCE before you get control of the dialog. }
    
    				SetField(21, Num2StrF(3));		{ set initial field value to 3 - fields are always text, even numeric ones. }
    				SetField(22, Num2StrF(2));		{ set initial field value to 2.2 - fields are always text, even numeric ones. }
    				SetField(23, 'must be a #');		{ set initial field value to Q - fields are always text, even numeric ones. }
    
    			end;
    		1: begin		{ OK was pressed, collect all data from dialog and get ready to exit. }
    				if ValidNumStr(GetField(21), X) then			{ This line moves first value to X }
    					if ValidNumStr(GetField(22), Y) then		{ This line moves second value to Y }
    						if ValidNumStr(GetField(23), Q) then	{ This line moves third value to Q }
    							begin
    								{ *** do something here, if needed. *** }
    							end
    						else item := 23	{ change item if Q data was wrong. }
    					else item := 22		{ change item if Y data was wrong. }
    				else item := 21;			{ change item if X data was wrong. }
    
    				if (Item<>1) then SelField(Item);			{ Return cursor to offending field. }
    				if (Item=23) then SetField(23, 'must be a #');	{ reset value to Q. }
    			end;
    		2: begin end;					{ Cancel button }
    		21, 22: begin					{ First and second field }
    			{ Not necessary to do anything here, but you can if you want to. }
    			{ This item will execute each time you enter this field, or type or delete a character in this field. }
    			end;
    		23: SYSBEEP;					{ Third field - BEEP -  Just for grins }
    	end;		{ case }
    End;		{ DialogDriver }
    
    
    
    BEGIN
    dlogID := DefineDialog('Dialog Name');
    if VerifyLayout(dlogID) then 
    	dlogResult := RunLayoutDialog(dlogID, DialogDriver);
    
    if (dlogResult = 1) then			{ 1 means OK button was pressed. }
    	message('X = ', X, '   Y = ', Y, '    Q = ', Q);		{ display values in the MESSAGE window when program completes. }
    END;		{ Sample3itemDialog }
    Run (Sample3itemDialog);

  5. They are undocumented routines that currently work, but have yet to be added to the VS Function Reference. Perhaps they are not fully tested, so use them with an open mind. The intent of some are quite obvious, while others are more obtuse. As well, the interfaces are not always accurate, but the compiler will usually give you clues as to what it is looking for. Take this call as listed:

    function CircleCircleIntersec(cenPt1X, cenPt1Y, cenPt1Z : REAL; 
    				cenPt2X, cenPt2Y, cenPt2Z : REAL; 
    				radius1: REAL; 
    				radius2 : REAL; 
    			VAR pt1X, pt1Y, pt1Z : REAL; 
    			VAR pt2X, pt2Y, pt2Z : REAL) : BOOLEAN;

    which looks like it could be simplified to:

    function CircleCircleIntersec(cenPt1X, cenPt1Y, cenPt1Z, cenPt2X, cenPt2Y, cenPt2Z, radius1, radius2 : REAL; 
    			VAR pt1X, pt1Y, pt1Z, pt2X, pt2Y, pt2Z : REAL) : BOOLEAN;

    but, with help from the compiler, really needs to look like:

    function CircleCircleIntersect(CenterPt1, CenterPt2 : VECTOR;
    				Radius1, Radius2 : REAL;
    			VAR Point1, Point2 : VECTOR) : BOOLEAN;

    Trial and error is your best teacher.

    You can also peruse the VCOR Wiki for insight @ http://vcor.net/wiki/index.php/Category:VectorScript

    Don't forget to add to the Wiki when you discover useful tips.

    HTH,

    Raymond

  6. ej, thank you. You've made it look exceptional. The renderings in your gallery - even more so.

    Christiaan,

    One thing that did not show up in the picture above are the markers along the green line that correspond to the centers of the displayed fillets. The centers of all possible fillets lie on the green line and the green line gets closer to the red asymptote as the fillet radius increases, but never crosses it.

    In the file I sent ej the fillet centers were marked with Loci, which obviously did not print/render. I was expecting a screen shot, but I got a work of art. I really should have expected this, considering the source.

    Thanks again, ej.

    Raymond

  7. I can't for the life of me figure out what I'm doing wrong though. When I get to the point where I draw the arc it never meets the assumed centre line (see dotted line)??

    Christiaan,

    It is because the center of the arc is only on your assumed center line when the radius of the arc is infinite. Notice you started with a line tangential to both circles. That is equivalent to an arc of infinite radius. When the radius is less than infinite, the center point of the arc falls to one side of your assumed center line, namely, it falls to the side of the smaller circle.

    The path of all possible centers traces an hyperbola and one asymptote is the line you drew. The exception is when both circles are of equal radii, then the expected path of center points is vertical and bisects the line connecting the two closest points on the circles.

    Plotting the family of possible curves is quite beautiful. Perhaps Islandmon will post a picture if I send him the scratch file I've been using.

    Raymond

  8. In VW 8, and earlier, the VS editor closes when the Enter key is pressed (OK button default). Not so since then. Could we have that functionality back, please?

    When I am making late changes to a program I change one thing and then want to close the window and run the program quickly. After all these years, I still occasionally slap the Enter key to close the editor (wishful thinking) and then have to reach for the mouse. Having to mouse over to the OK button and then to the script palette is much slower than pressing the Enter key and then double clicking the script. OK, it's only a fraction of a second slower, but it's still bothersome.

    In VW 12.5 the VS editor now opens at the bottom of the file. In all previous versions it opened at the top. I rarely make changes at the end of a program, but constants and the like are at the top. Please return the editor to opening script files at the top.

    Thank you,

    Raymond Mullin

  9. Petri,

    For a rough estimate of the Em Space of a Font, create a textblock of the chatacter 'M' at the point size you desire and use GetTextWidth(). Delete the textblock when done. If I'm not mistaken, 'W' is wider than 'M'. Either width should get you close enough to do what you want.

    Raymond

  10. The MacMini is a very capable machine (and QUIET!). If you need bigger hard drives, they can be added externally, or a server can be employed. The only hardware concern I have is the video RAM is borrowed from system RAM. You would get better performance from a Mac with a video card, but you said you are only doing 2D drafting, so that shouldn't be a problem. However, because video RAM is shared, 1 GB may not be enough. Add more.

    Raymond

  11. Hi Petri,

    If you tire of navigating to two plug-in folders, put an alias of your User Plug-In folder in your VW application plug-in folder, then you only have to go to one place to find them all. If you put a space before the alias name it will always show at the top of the list when sorted by name.

    " Plug-Ins" is my alias, but you can call yours " Preciousss" if you likes.

    HTH,

    Raymond

  12. If you just want it for selected instances you can select the dimension objects and adjust the "Text Off:" parameter in the OIP to a negative number. If you want it to be a permanent feature, then create a custom dimension standard. I'm not good at this, so check the manual or seek further help from a more qualified source.

    Raymond

  13. Hi tom_shady,

    There already is a function:

    IsPolyClosed(polyHandle: HANDLE) : BOOLEAN;

    so you don't need to redefine it. It is still as yet undocumented but can be found in the SECRET Undocumented Commands file in your personal Plug-ins folder (VWPluginLibraryRoutines.p).

    But that only solves part of your problem. A vertex can be set visible and still be unseen, and conversely, set invisible and still be seen. It all depends on what kind of vertex you are referring to and what kind of vertices are in the Polyline. As a general rule, a segment of a Polyline is made visible or invisible from one corner point to the next, including all the control points (Arc, Bezier & Cubic) between them. If any of the control points between 2 corner points is set invisible then the whole segment between the 2 corner points disappears.

    Then there are two degenerate cases:

    1) A closed Polyline with one corner point and any number of control points. If any vertex is set invisible the whole Polyline disappears, since visibility is applied from one corner point to the next. In this case it's the same corner point, hence it all goes invisible.

    2) A closed Polyline with no corner points cannot have invisible segments. It cannot be opened, either.

    One more rule:

    For a Polyline to be OPEN it must have a corner point on each end.

    HTH,

    Raymond

  14. Kaare,

    I've been watching this from the sidelines and finally went to see for myself what the fuss is all about. I got it to happen when I used to Line tool and then went to Zoom with boomerang mode. Yep, Interactive Zoom.

    I noticed the Line tool was set to Unconstrained Mode - the second mode, same as Interactive Zoom Mode. I reset the Zoom tool to Marquee Mode and set the Line tool to Constrained Mode. Now when I boomerang to the Zoom tool I get the Marquee Mode.

    Your problem seems to be linked to the mode of the tool you are coming from. If your tool mode is 2 or higher you get Interactive Zoom Mode. Try it with the Rectangle tool which has no mode buttons. You will boomerang to Marquee Zoom Mode, assuming the Zoom tool was in Marquee Mode to start with.

    Now pull the nails from your forehead and learn to draw with tools in their first mode. ;-)

    HTH,

    Raymond

  15. You can export the Loci positions to a text file using the File->Export->Export VectorScript... menu.

    If you first copy the Loci to a blank file (using Paste In Place) then export the VS file it will be very easy to find the Locus() data. With a little massaging in your favorite text editor you can have the data in any format you desire in a matter of minutes - OR - you can write you own VS and have your data formatted perfectly in a few hours or days. ;-)

    HTH,

    Raymond

  16. Dear NNA,

    This is a small request, but it would save me a lot of awkward mousing. When I want to close the VS Editor window I must click on the OK or Cancel buttons. If pressing the ENTER key would activate the OK button and ESC and/or CMD-period would activate the Cancel button I could close the window very quickly from the keyboard, which is where my hands are when I'm done typing.

    It used to work this way in VW8. Please bring it back.

    Thank you,

    Raymond Mullin

    User since 1990 w/ MC+2.0

×
×
  • Create New...