Jump to content

Martin Crawford

  • Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Martin Crawford

  • Rank

Personal Information

  • Location
    United States

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi I have successfully (only with help from the smart folks on the forum) to select a bunch of object, then create (3) sheet layers for each object. I finally got it working, and now I have a few cleanup details left. 1) How can I force a complete redraw of the layer after the title block is placed. It does not appear in the correct location and I have tired everything to try and make it work. ResetObject ReDrawAll ReDraw ResetObject(layer) Nothing seems to make any difference at all, except when the script is done running everything pops into place. What I trying to accomplish is place the title block on the page, get it to reset correctly. Inside the tile block there are a number of loci that control where I would like my viewport in the drawing and help me determine the best viewport scale. 2)When creating the sheet layer, I add a title block. When the scripts ends, the field Total Num Sheets is incorrect, it needs to be reset. Is there a way to force a reset of the tile block so the value is correct. Thanks Martin
  2. Martin Crawford

    Viewport Position

    I finally got it working. I'm not sure why, however a ResetObject was needed after the layers and classes were turned on. Thanks for pointing me the right direction. For some reason this was tough to get working. Again, Thanks! Martin
  3. Martin Crawford

    Viewport Position

    Wow! Nice reference! Not related, but a long time ago I have a VW bug. I found a book on VW repair. This book was so well done that at 14 I rebuilt the engine one a 1969 classic VW. It ran for years. I wish I had the same book for VW & Python scripting. Every step seems like a slugfest. I've been banging my head against the wall all day trying to get viewport centering to work correctly. Using the following code: viewPort_X and viewPort Y are always 0. What is super strange, is when I run the script it leaves me on the last sheet layer created and I can see a viewport created at 0,0 (with a red x through it). If I change sheet layers and change back, the viewport shows up in the wrong location. You can see the two attached screen shots to see what I am talking about. I've tried adding ReDraw and ReDrawAll in multiple points in the code and it makes no difference. I'm using 2108 sp3. It seems like some type of reset or redraw is required after the VP is created or maybe after the crop is set. Any thoughts? Martin
  4. Martin Crawford

    Viewport Position

    MullinRJ How do you know they are read only? When I look at the appendix I see the following: Scale 1003 REAL ObjectVariableReal Viewport x Position 1024 REAL ObjectVariableReal Viewport x Position 1025 REAL ObjectVariableReal I don't see anything that would indicate 1024 and 1025 are read only. Where do you find that nugget of information. Thanks
  5. Martin Crawford

    Viewport Position

    This makes perfect sense. Thanks! I still don't fully "Grok" the Vectorworks API. Sometimes things are straight forward and other times it seems convoluted. I will keep working at this and hopefully one day I will be able to answer a few questions. Again, Thanks Martin
  6. Martin Crawford

    Viewport Position

    I figured out how to scale a viewport, now I want to position it correctly. The following works: vs.SetObjectVariableReal(vpHandle, 1003, 32) #scale The following does not work: vs.SetObjectVariableReal(vpHandle, 1024, 0) # x vs.SetObjectVariableReal(vpHandle, 1025, 0) # y I get the following error message: Error: SetObjectVariable failed with constant 1024. This typically due to the operation being not supported for the passed object handle. As far as I can tell in the documentation, setting the x and y should be the same as setting the scale. I can't seem to figure out why one works and the other doesn't. Thanks Martin
  7. Martin Crawford

    Viewport Scale

    wait.. This seems to work. vs.SetObjectVariableReal(vpHandle, 1003, 32) thanks to twk for the answer. Martin
  8. Martin Crawford

    Viewport Scale

    Hi I am working on a script to automatically create sheet layers, with viewports with layers and classes set correctly. I have figured out how to get the following working: Create Sheet Layer Name Sheet Layer Create View Port Set Layer Visibility Set Class Visibility When the Viewport is created the scale is set to 1:1, how can I change the viewport scale? Thanks Martin
  9. Martin Crawford

    Creating Sheet Layers

    Nice, this is very helpful. Is there a way to change the Sheet Number after the layer has been created? I have tired a few different approaches and I can't seem to find a way. Martin
  10. Martin Crawford

    Creating Sheet Layers

    Hi I am having a strange issue when I try to use Python to create sheet layers. The following code: layerName = 'Module Layout - ' + screenName vs.CreateLayer(layerName, 2) Creates the follwoing: How would I set the Sheet Number and set the Sheet Title of the text in the Sheet Number? Thanks Martin
  11. Martin Crawford

    A “by current class” choice in symbols

    While it is not an “elegant” solution, I wrote a python script to create an outline of the symbol and fill with a preselected color. I found this to be an easier approach than maintaining multiple symbols of the same thing. When done I put the color on a different class. Not pretty, but it works. You should be able to create a custom plugin that takes a symbol name and color and places and sizes a single symbol definition. You should be able to do this with Marionette and if you post in the forum someone will assist. The support is pretty amazing. I started with Marionette and quickly moved to python as I found it easier for some of the things I was trying to accomplish. I am confident this could be done in Python. I have a recorded training session that walked me through how to do this with menu commands, I will see if I can find the steps. Creating a script should be doable. i am happy to assist, if you need help. Martin
  12. Martin Crawford

    Custom Plug-In Question

    At the moment I am using a tool and not a menu. You approach is interesting, however I have many different use cases that this approach would not work. The screen is often sliced in the raster to minimize processor. The pixel dimension is used in many places and not always attached to a single object. We often will have door or window cutouts that will also get a pixel dimension attached. Thanks for the suggestion. Martin
  13. Martin Crawford

    Custom Plug-In Question

    I have one plug-in that your enter the size, model, screen name and a few other details and it will draw a basic screen. This plug-in places symbols into the drawing. The symbols all have a specification record attached that contains the size in mm and the size in pixels. I enter the model from a dropdown on the plug-in, I then extract all the data from the specification record. This is called Create Screen. The second plug-in is an attempt to replicate the dimensions tool. Currently I enter the model (same way as the Create Symbol), and a scale factor. With this data, I extract the size in mm and pixels and do the math for how many pixels wide/tall the screen is. This is called Create Pixels What I would like is when I use Create Pixels I have way to select the screen it is being attached to (from the Create Screen) plugin, then extract the correct data with need to enter any data. When I run Create Pixels, I always am selecting a corner of the Create Screen object, is there a way to get and record the handle (is that the same as UUID?). I'm not sure how I would go about doing this. The way I'm doing works, however if you have the wrong model or wrong scale, then the math is incorrect. I am happy to send you a copy of the plugins, if that helps, however I would prefer to not publish to the forum.
  14. Martin Crawford

    Custom Plug-In Question

    I have a plug-in that calculates the number of pixels for a set of screens. I currently have to manually enter the pixel pitch and scale of in order to calculate the correct pixels dimension. What I would like to do, is have a way to "attach" the object to another object that I can then use to pull the pitch and scale data from. If either changed, then the pixel math would automatically change. I would be similar to how the dimensions feature works currently. Is there a way to create a plug-in that is linked to an object. Thanks Martin
  15. Martin Crawford

    Worksheets Selection Not Working

    Thanks I have a lot of symbols, around 200 (and growing), so that would be cumbersome. I think they way I'm using classes also won't work. So, I think I will go the record route. It's not perfect and does require some extra documentation for others on the team, but it will work. Thanks for your suggestions, I didn't think of the record solution. Martin P.S. How to I report this as a bug?


  • 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.
  • ×