Jump to content

Pat Stanford

Moderator
  • Content count

    4,766
  • Joined

  • Last visited

Community Reputation

303 Spectacular

About Pat Stanford

  • Rank
    Vectorworks Addict

Personal Information

  • Homepage
    vectortasks.com
  • Location
    El Segundo, CA, USA

Recent Profile Visitors

2,958 profile views
  1. Custom Plug-In Question

    You should be able to do this with Associations: VS:AddAssociation VS:RemoveAssociation VS:GetNumAssociations VS:GetAssociation Basically Associations create a link between two plug ins. An association of kind 4 deletes the associated object when the master is deleted. Kind 5 resets the associated object when the master is deleted. Your "dimension" PIO would be the associated object. You probably want to create at least a Kind 5 association and probably both (2 different associations). Then when the screen is reset, your dimension will be reset also. In your reset code us GetAssociation to get a handle to the screen object and then do what you need to copy the data from there into the dimension object. It will probably need some playing to get it to work, but the online version of the function reference has a pretty good example of AddAssociation. http://developer.vectorworks.net/index.php/VS:AddAssociation. Ask again if you need more help.
  2. Window Schedule in wallstyle

    You can do this with a simple worksheet script in a database row that returns objects that can be inserted in walls. It will return the name of the wall style each object is inserted in. If you include a =Count column and Summarize on the Wall Style, you should get a count of how many objects are in walls of each Wall Style. Either create a vectorscript in the document with the following script OR save it as a text document into the Application/Workgroup/User folder Libraries:Defaults:Reports~Schedules folder. I used the name GetParentWallStyle, but you can use whatever name you want. It just has to match how you call the function. If the script is in the document use =RunScript('GetParentWallStyle'). If you put it in the library use =RunScript(120,'GetParentWallStyle.txt') Procedure GetParentWallStyle; {April 24, 2018} {© 2018,2016, Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {No Warranty Expressed or Implied. Use at your own risk} {Returns Walls Style Name of the wall each object} {in the database that is inserted in a wall is in.} Var H1:Handle; Begin H1:=WSScript_GetObject; WSScript_SetResStr(GetWallStyle(GetParent(H1))); End; Run(GetParentWallStyle);
  3. Custom Plug-In Question

    More info for a better answer please. Is your plug-in just a calculation or is it an object that is placed in the drawing? How is the pitch and scale attached/entered for the other object? What makes entering the data there better than entering the data into your calculation PIO? You should be able to make a link to another object, but it will depend somewhat on how much control you have other the objects. Assuming you don't have control over the object that has the pixel information, I would consider adding a custom Record to that object and then storing a UUID into a field in that record. Store the same UUID into your calculation PIO to create the link and then figure out how to get the pixel information to transfer. Probably need two modes to the calculation PIO, one to create the link and a second to update the calculation using the preset UUID information.
  4. Window Schedule in wallstyle

    Would a way to display the wall style a door is in in a worksheet be enough? I am pretty sure I can write a worksheet script to return the Wall Style that a door in wall is inserted into. I am not certain I can get a database to be limited to doors that are in certain styles of walls. Alternatively, a script could store the Wall Style into one of the User Fields (or a custom record format) and you could use that to limit the database. But if a Wall Style changed you would have to remember to run the script again or you will get incorrect information.
  5. Creating Symbol with 2 Different Color by Class

    Chain Hoist is both a tool and an object. The tool part let's you insert the object into the drawing. The object is what remains in the drawing with all of the settings. Let's get @Sam Jones into this conversation and see if he has a pre-made solution. If not, we can do a quick and dirty scripting course. Actually, I kind of think that Marionette might be a better way to script the creation of objects. Vectorscript is easier to use to modify things, but since Marionette handles all of the interaction with the Object Info Palette, it may be easier. Can you post a sample of one of your symbols? Are they very complicated?
  6. Creating Symbol with 2 Different Color by Class

    I don't think symbols are going to work for what you want. In a symbol, you can certainly class different parts and use different fill colors, but EVERY instance of the symbol is going to use the same classes for those parts. If you need to have different instances show different colors you are either going to have to make duplicate symbols or you are going to have to use something other than symbols. One option would be to use symbols, but use the Convert to Group option. This will convert the symbol into a group when it is placed. You could then edit the group to assign the classes/colors you need. But you lose the ability to have them function as symbols. If you have to edit the symbol definition later, the ones converted to groups will not change. The best solution probably depends on how many instances you have in a drawing and how many different color combination you need.
  7. Renderworks - is it worth the effort

    Sorry I can't resist: "Sit quietly and stare into the flame. Slow your breathing. Now focus your energy on your interior tutorial."
  8. Script for dotted lines

    Your RGB values are not right. Each of R G B should be in the range of 0 to 65535. 121 is really small, so the very small trace of red is not noticeable. Try using 65535, 0, 0 in the SetPenFore and you should get a real red. The following script will give you the RGB values for the first selected objects PenFore. Select an object with the color you want and run the script the three values will show up in the dialog box as the X, Y, and Z fields. Using the existing 3Pt dialog box was a quick and dirty hack to get an easy display. Procedure Test; Var R1,G1,B1:Real; Begin GetPenFore(FSActLayer,R1,G1,B1); PtDialog3D('RGB Is', Concat(R1), Concat(G1),Concat(B1),R1,G1,B1); End; Run(Test);
  9. vLookup function

    I have not actually tried the script, but was the range you were pulling data FROM in a database? Or was the FROM data stored in spreadsheet cells? I ask because I have not been able to find a way to access the row that a database subcell is in. I have a request in for a function that will return the cell address that a worksheet script is running from. I have a number of scripts that could be very interesting if only I knew WHERE the script was running. Pat
  10. Script for dotted lines

    The way the script is written, it will only work on lines weight of EXACTLY 2, 5, 7, 10, 20 mils. If you normally work in something other than mils or other line weights, then that part of the script will need to be modified. I just copied and pasted the script from above into a VW Script and ran it on a rectangle 20 mil with a blue pen color and a Circle 10 mil with a red pen color. Both ended up being 5 mil with a dark grey/black pen color. Or did you want to fill color to change? Since we were talking about lines, I assumed it was just the pen color.
  11. Script for dotted lines

    First, if you are pasting code into the forum, try and use a code block. Click the <> button in the formatting bar of the post and then paste into that block. It will keep the formatting better. Try this: PROCEDURE LineWeightChange; { (c) twk based off of original code by Petri Sakkinen 2008 } CONST newWeight = 5; PROCEDURE ChangeIt (h : HANDLE); VAR oldLW : INTEGER; BEGIN oldLW := GetLW(h); IF (oldLW = 2) OR (oldLW = 5) OR (oldLW = 7) OR (oldLW = 10) OR (oldLW = 14) OR (oldLW = 20) THEN Begin SetLW(h, newWeight); SetPenFore(h, 221,0,0); End; END; BEGIN FOREACHOBJECT(ChangeIt, ((SEL=TRUE))); END; RUN(LineWeightChange); When I wrote Handle, I meant to use a handle to the object. A handle is an identifier for the program to use to find a specific object. In the case your (Petri's) script, the variable that is being used to hold the handle is h. Second, when you want to do more thing as the result of and IF/THEN or REPEAT or UNTIL conditional, you have to put all of the multiple statements between a Begin/End pair. HTH.
  12. vLookup function

    Nice work. Does your version work in a database row or only in a worksheet row? For those not a deeply into worksheet and scripts, to make this work, you would need to make a subfolder in the [Application or Workgroup or User] folder in the Libraries/Defaults/Reports_Schedules folder and store the WSVLookup.py file in that folder. In the worksheet (as it says at the top of the script) you would use script by using a RunScript function. The 4 parameters that need to be passed are: A cell containing the value to be searched for. The range in which to search. The offset from the found location to return The type of object you are searching for: 0=String, 1=Integer, 2=real, 3=image.
  13. Script for dotted lines

    For a single object or for all selected objects? The commands are the same, but the wrapper needs to be different. Do you need it to check the existing and then change only objects that have a specific setting? Or just set for selected objects? If you like the script above, then the basic commands you need are: SetLW(Handle, LineWeightInMils); For the color, you would use SetPenFore(Handle, R,G,B); So you will need to get the RGB value you want. If you have it in a palette, you could use ColorIndexToRGB to get this. So just about like the above script, but with a little math to calculate mils and RGB. If you need more details, please ask again.
  14. snap to 2 objects

    I think Circle by 3 Points mode will get you close. Click on the 2 points you want to snap to and then hit the tab key to get into the Floating Data Bar and enter the 1500mm into the L (first) field. Then drag so the point on the red snap circle is the diameter of the circle. I think if you play with it a little bit you will see what I mean. If not please ask again.
  15. Reports Records Database Worksheet Schedule

    @Grethe Connerth I wrote a long post a couple of weeks ago that I think has some of the info you are looking for. Here is a short version answer to your questions: Records are a container for data that is attached to an object in the drawing. PlugIn Objects have a "Parameter Record" that contains all (most) of the data shown in the OIP and often more that is not shown. Certain complex PIOs (Stair, 2018 Drawing Border/Title Block) use a more complicated scheme and have data that is harder to access. The data in a record is stored in Fields. Fields can contain different type of data: Text; Numbers; Dimensions; Area Dimensions; etc. Normally Records (except Parameter Records) are attached to an object in the Data pane of the OIP and the field data is added there. Worksheets are a "Table Calculation Program" built into Vectorworks. They are similar to Excel or Numbers, but have more limitations and some special features. Worksheets consist of a rectangular array of "cells", arranged in Rows and Columns. Cells can contain Text, Numbers, or Formulas. Using Formulas, the data in other cells can be "referenced" using the row and column address of the cell. Cells that contain numbers (or formulas that provide a numeric result) and be used in mathematical calculations in other cells. Worksheets can have two different types of rows. Spreadsheet Rows work pretty much like other Excel like programs. You enter data and formulas manually. Some formulas will allow you to pull data from objects on the drawing by using Criteria to specify which objects to use. An example would be =Count(((L='Layer-1') & (C='My Class'))) which would count the number of objects that are on Layer 'Layer-1' and in the Class 'My Class'. The second type of row is a Database Row. In a database row, you specify the Criteria for the row and then you get a subrow for each object in the drawing that meets the criteria. Any formula that you enter into the Database Header Row will be automatically applied to every subrow. You can then Summarize subrows by the data in the formulas to get a smaller number of subrows. If we Created a Database Row using a Criteria of All Objects, we would get a subrow for every object in the drawing. If we created formulas in columns for the Layer (=L), Class (=C), and Count (=Count), then you would get a Count of 1 for each subrow. If you then Summarized but the Layer Column, you would end up with a single subrow for each Layer and the Count column would display the number of objects on that layer. Summarized objects can be nested to be more detailed. To me, Reports and Schedules are just different types of worksheets that pull the data necessary. The Create Report command is just a simplified way to generate a worksheet with a database row that uses the criteria you want and displays the data you want in the column order that you want. After using Create Report, you will probably still need to work on the formatting of the worksheet to get it to look the way you want. Schedules are a semi-standardized way to display data about objects in a drawing. It is a Worksheet/Report that has been generated and probably has the possibility to be reused in the future. Examples of standard schedules are Window and Doors schedules in architectural drawing. An Instrument List in a light plot is similar to a schedule, but often does not use that name. Since Worksheets are Resources, they can be moved between drawings using the Resource Browser. Once you create a door schedule you like, you can move it to your drawing, modify the database criteria if necessary, and you have a schedule in your drawing in a very short time. Worksheet are edited and can be used entirely in a stand alone window, including printing separately. Or, they can be set to be a "Worksheet on Drawing" so you will get an image of the worksheet as an object in the drawing. If you double click the Worksheet on Drawing image, it will open an editing window for the worksheet (and display as a box with an X in it on the drawing while the editing window is open). Close the editing window and the image on the drawing will update. I have specifically left out the detail steps on how to do any of this as I read your question to be more conceptual. I guess this is what passes for a short answer for me on work sheets these days. I hope it helps. If this is still unclear, please ask again.

 

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