Jump to content

Ryan McCuaig

  • Content Count

  • Joined

  • Last visited

Everything posted by Ryan McCuaig

  1. Ryan McCuaig

    Renaming a field in an existing record format?

    Hi Raymond-- Blerg, this is what I'd feared. Thanks for laying out the approach though. Seems straightforward but a bit more of a nail-biter than I'd like. Yeah, I'm not sure either that record fields even have handles, or at least not any VS can see. Fortunately it's not a PIO record. The records in question are regular user-attached records on drawing tags, as part of a schedule generator. I do use worksheets as part of the implementation, but (also fortunately) the worksheets aren't the source of truth (the tags/records are) and can be automatically re-generated after the record replacement. Ryan
  2. Is there a Vectorscript function to give a new name to a field in an existing record format? I'm really hoping that something with a signature like `FUNCTION SetFldName(recFormatHd : HANDLE; index : INTEGER; newName : STRING) : BOOLEAN;` exists somewhere, notwithstanding it not existing in the docs ... ie. the apparently missing setter half of `GetFldName(recFormatHd : HANDLE; index) : STRING;`. On reflection, I can imagine that this could cause some potential mayhem with existing record instances. But, my ability to rename a field from the UI suggests that it's perfectly do-able, but not exposed to Vectorscript. I'm speculating that that `GetParamName(size_t paramIndex)` hanging off of VWRecordFormat in the SDK's VW foundation classes is what the Vectorscript `GetFldName` is under the hood. But that class has only a `SetParamLocalizedName` ... no `SetParamName` so there doesn't look to be anything I could publish to Vectorscript with an SDK library.
  3. Ryan McCuaig


    Huh, yep. Crashes for me on Mac/2016 and 2017 too. Sorry. (That's what I get for typing in code off the top of my head). I thought it might have been the call to `vs.Message`, maybe on the hypothesis that dialogs tend to be callback-driven too and the message window is kinda-sorta a dialog, but no. This crashes consistently too: import vs def cb(pt): vs.Locus(pt) vs.GetPt(cb)
  4. Ryan McCuaig


    Note too that something like this will crash Vectorworks 2016/Mac for me: import vs def main(): vs.GetPt(lambda pt: vs.Message(str(pt))) main() and this will work OK: import vs vs.GetPt(lambda pt: vs.Message(str(pt))) As far as I can tell this is roughly what the line "This cannot be used if there is a function anywhere in the calling chain" from the docs means.
  5. Ryan McCuaig


    Even better: in Macintosh 2015 it's not a ZIP archive at all, but a folder that the OS treats as a "file" (aka. a bundle). Just right click and select "Show Package Contents."
  6. Ryan McCuaig


    For the benefit of future searchers, note that these are found in /path/to/Vectorworks/Vectorworks.vwr, which (despite the name) is a ZIP archive. Copy and unzip it, and you'll find all the system images in there at the file paths you'll need to use in the call to `AddListBrowserImage`.
  7. Hi all-- Apologies, this is me coming up for air from the stone ages: When did colour gradients start actually converting to a greyscale when the b/w only setting is applied (either as a doc setting or a viewport setting)? 2013? My former firm had been using gradient fills from/to the same colour to get flat colour fills in presentation elevations. The effect was that you could turn on b/w for the viewport and have all linework drop to black, but the fills stay coloured. As of 2013 this doesn't work anymore. Does anyone have any preferred replacement techniques? Viewport overrides seem finicky, but maybe not terrible given the eyedropper. Thanks Ryan
  8. Ryan McCuaig

    ODBC - How to on Mac

    @Assembly - haha, that's probably because they're the parts that don't actually say much. It's in progress... finally getting back into some SDK work, so I'm hoping I'll get the fourth instalment up soon.
  9. Ryan McCuaig

    ODBC - How to on Mac

    For what it's worth, I put together my writeup of getting ODBC going with MySQL on a Mac, and put together some scripts to get it going. http://ryanmccuaig.net/2012/06/20-vectorworks-mysql-odbc-mac/ In VW2011 at least, linking records to the database seems to have some performance issues, over and above the problems in conceptual clarity. I'm preferring to take it over and work directly with DBSQLExecuteGet et al from Vectorscript.
  10. Ryan McCuaig

    VW2008 vs VW2011 whats going on???

    Looks like the greyed-out bitmap problem is fixed in Mac 2011 SP3. We just encountered it in our office with some SP2 machines not displaying compressed TIFFs. The same TIFF worked fine with machines upgraded to SP3. (I'm now typing the words "gray" and "grayed" for the benefit of any Americans trying to Google this).
  11. Ryan McCuaig

    VW Preference Constants

    Holy moly. These are great, Raymond. Thanks for putting in the work.
  12. Ryan McCuaig

    Vectorscript Development Tools for Windows: Notepad++

    James-- If you're looking for free, try TextWrangler (Mac App Store) with the VSS language module: http://www.vectorlab.info/index.php?title=VSS_Language_Module_for_BBedit_%26_TextWrangler This will also work with BBEdit (paid). I tend to use TextMate (http://www.macromates.com) with the Vectorscript language bundle (https://github.com/textmate/vectorscript.tmbundle ... I'm the author of the original bundle, and I shamefully haven't gotten around to stitching in any changes to the official repository since 2007, so email me if you need it).
  13. Ryan McCuaig

    SDK Here I come!

    Mark-- Can't help you with the Windowsy stuff, but here's how I'm getting it: - If you see a GS_Foo(gCBP,...) call, that's deprecated. - New-style calls are gSDK->Foo(...) ... basically a method call on an object that's a big ball of SDK stuff. gSDK is a global instance of the ISDK class that gets defined by the boilerplate in plugin_main(). - The VWFC classes that Vlado has put together wrap up a lot of the side stuff (files, dialogs, folders on disk, etc) into an OO interface. The cpp source for these is in the 2011 sdk distribution (see $SDK_ROOT/SDKLib/VWFC/Sources); you can see that as of VW2011 these are just thin wrappers around old GS_Foo() calls. For what it's worth, I'm writing a basic (Mac) tutorial at http://ryanmccuaig.net right now. May be a month or two before I'm done, but I'm trying to keep it basic.
  14. Ryan McCuaig

    Select "through" objects?

    Thanks! I'd been staring at that thing so long it just turned into wallpaper. I forgot that it actually did something.
  15. Ryan McCuaig

    Select "through" objects?

    I remember a handy feature in AutoCAD: holding down "shift" while clicking on a series of objects stacked directly on top of one another, each click would select the next item down in the stack. Does anyone know if there is a way to do this in Vectorworks? At the moment, I'm just sending to back until I get the line I want. Thanks.
  16. Ryan McCuaig

    Creating PDFs on print

    I remember looking into this some years ago with VW 12.5/2008, and having to use CUPS-PDF to create a virtual printer: http://hints.macworld.com/article.php?story=2007082812233971 Much as I'd have loved to use the built-in batch PDF export routines, our regular service bureau uses an older PDF rasterizer. The rasterizer would choke on PDFs produced directly through the Vectorworks embedded PDF framework, but would be OK on ones produced using OS X's built-in PDF generator. Go figure.
  17. Ryan McCuaig

    vw2009 viewports

    Orso-- Thanks for packing that up as a tool. Call me crazy, but by Version 2011 (VW16) it strikes me that this should really be packaged in. -RMc.
  18. Ryan McCuaig

    setting text on file opening

    I don't think it's currently possible to have a script run on file open, though having scripts fire on events such as open, save, print, etc. has been briefly discussed as something worth implementing. As it stands, I'd probably implement it as a "Document Setup" menu command, similar to the Nemetschek-supplied one under "File > Document Settings > Document Setup..." (though this may be a VW Architect thing, so I'm not sure you'd have it). On the downside, you have to remember to run it after opening a template. On the upside, it wouldn't run on every save. To make it easier to remember, maybe include a big red note in the template, saying "run this script," that the script will delete on a successful run.
  19. Ryan McCuaig

    VectorScriot or ...

    I don't know the internals. It may be more correct to say the "VS Compiler Mode" command changes it from interpreting PIO code once per session to interpreting on every insertion, versus compiling. But I don't think there's any practical significance to the distinction here.
  20. Ryan McCuaig

    VectorScriot or ...

    @TheBlindExpert @maarten - I make a lot of use of Tools > Scripts > VS Compiler Mode during development ... it tells Vectorworks to re-compile every time the PIO is inserted. Turn this on, then just leave the VW script window open while you work on the code in your external program. If you've used {$INCLUDE whatever} and the right compiler mode, you should be able to save, switch to VW, hit compile, switch back to the editor, edit, save, back to VW, compile...
  21. Ryan McCuaig

    VectorScriot or ...

    I'd devote resources instead to the debugger, a console, and a visual dialog editor. Something along the lines of Interface Builder on the Mac would be fantastic. This is a major reason that Mac GUIs are so painless to generate. By console / interactive prompt, I mean one like AutoCAD's or Sketchup's. It's incredibly helpful for exploring and learning how VS works, without the overhead of making up a plugin. I don't think the text editor is a priority. Editors are very personal things, and NNW can't hope to keep up with the dedicated programs. All I ever do during development in the VW editor is {$INCLUDE something.vss}, work on the file in TextMate, using a Vectorscript syntax customization I've put together. When ready, I paste back into the VW text editor. So, I'd support more hooks for external editors instead, and leave the development of editor customizations to outside devs. This is work that we can do; save Vlado's time for things that we can't. +1 for Pat's suggestion about hooking scripts to events, firing eg. on print or save.
  22. Ryan McCuaig

    GetRField equivalent in SDK

    Looks like VWFC::VWObjects::VWRecordObj has some methods for this, like GetParamValue(). Check VWRecordObj.h ... I couldn't find anything on the developer wiki. How you get a VWRecordObj given a handle to an arbitrary object is a little fuzzy to me.
  23. Ryan McCuaig

    Developing for the mac

    Yes, Xcode is what you're after. Pay special attention to the setting up of targets, and locating header files. A lot of the build errors you'll get are related to Xcode not being able to locate hard-coded paths to headers and static libraries.
  24. Ryan McCuaig

    VectorScriot or ...

    I would support Ruby or Python as the next generation of Vectorscript. C#, Java, or C-like, strongly-typed, finicky languages should be confined to the SDK. Most of what I've wanted to do can be done in Vectorscript; I just find the syntax (especially loops) cumbersome compared to Ruby, the inconsistent API syntax can be trying, and the need for variable declarations no longer seems necessary. In principle, there's plenty of room for two environments: 1. the hand-holding, garbage-collected, weakly-typed, get-it-done environment (henceforth known to me as VectorRuby), and 2) the chainsaw that is the SDK. I don't really care if it's C# (or Mono for us Mac people), but it seems to me that the SDK should simply be a thin bundle wrapper to provide a code entry point, plus a C library and a bunch of header files that can be called from whatever environment people would prefer to use.
  25. Ryan McCuaig

    Use Class Attributes

    Something like this should work on selected objects in the current layer. I like to confine any ForEachObject() operation so that I can see the result. In bigger files, you can cause havoc and not notice for a while if something happens to an invisible layer. But if you put (ALL) in place of ((SEL=TRUE) & (L=lname)) it should nail everything... might have trouble with things in groups. Hope this helps. PROCEDURE Main; VAR lname : STRING; i : INTEGER; PROCEDURE UseClassAttribs; VAR h : HANDLE; BEGIN h:= FSActLayer; { get a handle to the object } { set the object to use the class settings for } { its display attributes } SetFillColorByClass(h); SetPenColorByClass(h); SetFPatByClass(h); SetLWByClass(h); SetLSByClass(h); END; { PROCEDURE UseClassAttribs } BEGIN i := 0; lname := GetLName(ActLayer); ForEachObject(UseClassAttribs,((SEL=TRUE) & (L=lname))); AlertInform(Concat('UseClassAttrib applied to ',i,' objects'),'',TRUE); END; { PROCEDURE Main } Run(Main);


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.