Jump to content

kiwi

Member
  • Posts

    104
  • Joined

  • Last visited

    Never

Everything posted by kiwi

  1. As anyone develop PIO's with control points parameters? I'm getting problems to set the parameters to other values than the default ones during the first plugin run... he seems that during the Run() those values are constants set to the defaults values. I've try SetRField() inside a IsNewCustomObject() dependent statement, but the debugger shows no change on the PControlPoint01X and PControlPoint01Y values. The PIO works find, but the first run is a disaster since the control points are not placed where they should... I need to rescue them manually and place then at they respective locations. There is no way to define a good default values (I have 4 control points): the PIO draws anywhere at any scale or any shape! Thanks,
  2. You may don't need a VS key stroke... you can reach must of the menu comands ussing the function DoMenuTextByName().
  3. Set a boolean or a controlling variable for your event menu option ( I use a radio buttons parameter) , and set the event inside a IF (or case with more than one option). The update will always happen, but you can decide what part or functions of your code are running.
  4. I recommend BBedit... he doesn't have a specific VS function research, but the syntax coloring is extremely helpful: the functions names turn blue once spelled correctly. The glossary is priceless, you can set all your common structures and procedures and use a single click to insert them on your code. Most of my work is done this way: get a handle on mouse click, a WHILE statement, own brew offset procedure... a single mouse selection and the debugged code is on your script. For myself I use BBedit on one screen and Safari on the other, the glossary is normally set by class and slowly I've learn most of the functions. But as my libraries grow I recycle more and more code increasing productivity. The winer would be a semi transparent widget... I may work on that!
  5. "Could I use "SetName" using the handle to a layer?" Sounds like the right thing to do...
  6. Going too fast as usual I agree on the correction... Thanks Raymond
  7. Sorry: an easy insight into VS functionality.
  8. They are many ways to do this, but this script keep the normal operator logic: -ask for a scaling factor -memorizes all the selected objects -deselect everything -select each object to apply the scale factor -reselect everything to keep working It works (so far!), and is an easy insight into VW functionality. code: Procedure Individual_Scale; {debug} VAR x,y: REAL; h: HANDLE; i,j: INTEGER; MyH: DYNARRAY [] OF HANDLE ; BEGIN x:=RealDialog ( 'enter a scaling factor','0.5'); y:=x; h:=ActLayer; j:=NumSObj(h); {how many objects} ALLOCATE MyH[1..j]; {allocatating the memory} h:=FSActLayer; FOR i:=1 TO j DO BEGIN {this keep on memory the objects handle} MyH:=h; h:=NextObj(h); END; DselectAll; {we deselect everything} FOR i:=1 TO j DO BEGIN {this select each object and apply the scale procedure} SetSelect(MyH); Scale(x,y); SetDSelect(MyH); END; FOR i:=1 TO j DO BEGIN {this select all the scaled objects} SetSelect(MyH); END; END; RUN (Individual_Scale); [/code]
  9. I use a thumb drive one... it was the only usable one I found the day I star to feel the "mousse syndrome". I know is not the best (microsoft) but I like the thumb accuracy and the way my hand rest on the more than generous ergonomic surface. One side the thumb, and the other with the scrolling wheel and 4 buttons for the rest of the fingers. A couple of days to get use to it, but big productivity gains! I still need to try a finger tip one, but at the moment I'm more than happy with what I use. My best trick is to spin the ball to send the cursor across both screens, and stop it just on the right point... impossible with the mouse, my table is not big enough and I'll need to do this annoying thing of lifting the mouse a few times to get where I want!
  10. Get a trackingball... multi-buttons, wireless, fast, deadly accuracy, and forget mousse related pains... specially if you use big/multi screens
  11. English is not my native language, and I hardly manage to badly express myself... I can only accept your explanation, and agree about the polynomials passing though the control points. But this means that the spline doesn't follow the polynomials? this only confuses me, since the polynomials are the spline definition... a bit like if an arc is defined by a center and radius, but the arc drawing end up with a different curvature. As a graphical definition, any cubic spline point should respect the polynomial definitions, and if the control point respect the definitions it should be part of the spline. I do agree there will always be some delta factor, but on this case he seem disproportionate, and he raises the uncertainty when verifying the accuracy of some algorithms I'm developing in VS aiming to emulate cubic splines. I'll run cubic splines on Mathlab and other CAD software to see how they behave... It may should have been the first step on my understanding, but again I'm just learning and seeking answers on my dealing with polylines.
  12. From Mathwold "A cubic spline is a spline constructed of piecewise third-order polynomials which pass through a set of m control points." Draw a 3 sided polygon, duplicate and you'll see that if you change the second vertex to a cubic vertex (or smooth cubic) the graphical representation doesn't mach the mathematical description... the curve doesn't pass trough the cubic bezier (zoom in). Now draw the line between the first and the third vertex, and another one from the middle of this last one to the second vertex. On the IP multiply the last line length by two and place a locus at the new end point. Now draw a polyline using our locus as bezier point and the precedent start and end points... on this case the cubic representation is close correct. I say "close to correct" because on a earlier post (on the vectorscript forum) I notice that in VW the bezier splines representation doesn't follow perfectly the De Casteljau's algorithm (only for parameters 2^x). I may add that the split tool doesn't show regular result's when working on polylines. You can find points where the tool doesn't work properly, and the results vary with the selected mode. I found this one splitting a couple of hundreds of plolylines... he seem that time to time I hit on the wrong spot forcing me to complex maneuvers to get the job done. So far, even if annoying, this facts where not a real problem. But the cubic representation lack of accuracy is not acceptable... is way of range, and it becomes difficult to mach objects form a graphical point of view.
  13. I must say that press the key combination control+c do exactly the same with out the need for scripting
  14. I'm having a similar problem, with a script forcing VW to crash after running it a few times and zooming or modifying the drawing in any way. Even after a single run, I know that soon or later the app will quit. I never found a cause, but the 2000 lines of script compiles and debug flawlessly... the only message I get is the "reassign a dynarray could cause the loss of data". At the moment I'm working on a new version with a new approach trying to overcome the problem. But I will look a the overlapping variables to see if is the cause!
  15. Try this: code: DoMenuTextByName('Cut',0); [/code]
  16. kiwi

    InsertVertex()

    OK... I find that the document I was working on was kind of corrupt, and for some reason send all my scripts off coordinates.
  17. kiwi

    InsertVertex()

    I try everything... GRRRRRRR Is quite a big script, and so far I just develop my how AddVertex() procedure to keep going: read the old one, delete and create the new one... clumsy but I get the results to keep going. I always check graphical values with Locus(): my BBE glossary templates are full of { locus(MyP.x,MyP.y) } all ready to jump on action. A slow down on the debugger show the right values, the right position for the vertex... but the redraw is depressing! I'll try again tomorrow! Thanks Raymond
  18. I'm having issues with he InsertVertex() function... it don't seem to respect the values x,y: REAL I pass to the script. I'm not sure if I'm missing something or is a bug... if someone could draw-select in VW 11 a 3 sided polygon and run this line to see if the new vertex end up in 100, 100... for me is always in 4333.8, 835.8 code: InsertVertex(FSActLayer,100,100,2,0,0);[/code]
  19. kiwi

    View control

    Upsss! and I've ben after those for a while, but couldn't find where in the menus they where hidden! thanks...
  20. kiwi

    View control

    As any one find a way to assign a key or script the next and last view functions (the two little buttons on the windows bottom left corner). I like to use them, but is totally impractical and unproductive to send the cursor across the screens and click on the tiny buttons.
  21. The run script in 11... I try with the unit identifiers, and I do get a 100m extrusion on a 100m*100m rectangle. With out the units identifier, he follows properly the document units... on both cases I obtain a rectangle and 6 ungrouped nurb surfaces corresponding to the extrusion. I then try 100*100 rectangle, extruded to 100m and this work too... But is a non sense... the VS function doesn't produce the same results than the tapered extrude tool!!!
  22. The Real variable "100" for the extrude defines a height, not a length... you may change your object orientation (or the working plan) to use the function over the length. 10cm are 100mm, he looks like your vector script need to mach the document units, for 100m you'll need 100000 units if you document is in mm. Hope this is of any help!
  23. kiwi

    .plt

    PLT is analog to HPGL... Is not design to hold bitmap data, but is good to hold compact vectorial data to send to a plotter. Most of the plotters work on HPGL as a input format since the only information they normally need is the path and the tool used (some have 3 or 4 tools). The tool is set by the path color, and the rest looks like " move to point, tool x down, move to, curve to, tool x up, move to tool y down, arc to..." Since is similar in aspect to Pascal, I develop a plug in that read and exports HPGL (at least one of the non crypt versions), and any search on google will put you on the right path. The format is not design to print pictures, but to describe efficiently (and 20 years ago) a 2D vectorial drawing. Some mac software to convert the format http://www.aeronautauto.com/pages/softsumm.html The old CADintosh use to be able to import and export HPGL... I'm not sure if he still do?
  24. This as been bugging me for a while... Since we don't have access to the "trim" command from VS, but I do need to split polylines at any point of they path a custom procedure was needed... but for some reason the results, even if good are not perfect! The base of the work is the De Casteljau's Algorithm (here is some info about: http://ironbark.bendigo.latrobe.edu.au/~fran/int32gp/2004/wk13/lctr26.html). At the first place I was thinking the problem lay on the inherent accuracy of a single point float value, but the algorithm work beautifully 2^x numbers (if you use the script at i:=4 or i:=8), but not so well with anything else (i:=3 and zoom in quite a bit to see the inaccuracies). At values like i:=12 you can see locus in the curve and others slightly out of it. The Algorithm is suppose to work for any factor, and I'm wondering why we get this inaccuracies? A bit of trigo on the De Casteljau's enable to cut a polyline at any selected point along a bezier curve, and there is no need for much more code to do so, but at the moment the results show the same pattern of inaccuracies than the algorithm. I hope anyone has any input on the subject, or can come up with the algorithm VW use to define bezier curves. I'm trying to develop the same functions using NSBezier (cocoa) to see if is any better. -The script only works on 3 vertex bezier polyline. I recommend to draw a 2 sided polygon, duplicate and smooth by bezier spline. Then you can run the script selecting the polygon's 3 vertex. I keep the input as 3 points to experiment on different orders or configurations code: Procedure De_Casteljaus; {debug} VAR x,y,a1,a2,d1,d2,a3,d3: REAL; h: HANDLE; s: STRING; i,j: INTEGER; o,u: BOOLEAN; P1,P2,P3,p4,p5,p6: POINT; BEGIN {Select polyline first point, the bezier point, then the last point} {} GetPt(P1.x,P1.y); {} GetPt(P2.x,P2.y); {} GetPt(P3.x,P3.y); {Poly sides angles calculations} IF ((P2.x-P1.x))>0 THEN a1:=Arctan( (P2.y-P1.y)/(P2.x-P1.x) ) ELSE a1:=Arctan( (P2.y-P1.y)/(P2.x-P1.x) )+ Deg2Rad(180); IF ((P3.x-P2.x))>0 THEN a2:=Arctan( (P3.y-P2.y)/(P3.x-P2.x) ) ELSE a2:=Arctan( (P3.y-P2.y)/(P3.x-P2.x) )+ Deg2Rad(180); {Poly sides distances calculations} d1:= Sqrt( Sqr(P2.x-P1.x)+Sqr(P2.y-P1.y)); d2:= Sqrt( Sqr(P3.x-P2.x)+Sqr(P3.y-P2.y)); i:=4; {number of subdvisions} FOR j:=1 TO (i-1) DO BEGIN {New points P4 P5 along the sides} P4.x:= P1.x+(Cos(a1)*d1/i*j); P4.y:= P1.y+(Sin(a1)*d1/i*j); P5.x:= P2.x+(Cos(a2)*d2/i*j); P5.y:= P2.y+(Sin(a2)*d2/i*j); IF ((P5.x-P4.x))>0 THEN a3:=Arctan( (P5.y-P4.y)/(P5.x-P4.x) ) ELSE a3:=Arctan( (P5.y-P4.y)/(P5.x-P4.x) )+ Deg2Rad(180); d3:= Sqrt( Sqr(P5.x-P4.x)+Sqr(P5.y-P4.y)); {New point P6 on the polylines calculation} P6.x:= P4.x+(Cos(a3)*d3/i*j); P6.y:= P4.y+(Sin(a3)*d3/i*j); Locus(p6.x,p6.y); END; END; RUN (De_Casteljaus); [/code]
  25. Have you a sample of the files your CNC can read? I've add a few import and export plugins to VW on HPGL and other existing formats to use on plotter cutters. For specific sail design applications I've develop a couple of personal formats: next step is to get a controller and experiment a bit.
×
×
  • Create New...