Jump to content

Pat Stanford

Moderator
  • Posts

    12,626
  • Joined

  • Last visited

Everything posted by Pat Stanford

  1. =B2*C2 as stated will obviously multiply. Did you perhaps mean =C2/B2 ???
  2. Just figured this out as a way to determine the decimal separator if you need to work across multiple languages/regions. Tested on Mac OSX 10.9. Not tested on Windows or any other operating systems. Procedure Test; var S1:String; Function DecimalSeparator: String; Begin If Len(Substring(Num2Str(4,22/7),'.',1))=1 then DecimalSeparator:='.' else DecimalSeparator:=','; End; Begin Message(DecimalSeparator); End; Run(Test);
  3. What you are looking for is a Plug-in Object (PIO). This is a special type of script that needs to be written in Vectorscript, Python or using C++ and the SDK. If you have never programmed before the learning curve can be steep. Vectorscript is based on Pascal, so if you have experience there you are a leg up. The first place to look is in the Custom section of the VW website: http://www.vectorworks.net/support/custom/ From here you can get to the language documentation and some example code. There is also example code in this forum and in the Vectorscript Sharing forum. Robert Anderson posted a basic article about Vectorscript there some time ago that would also be a good starting place. https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=93218#Post93218 If you post with some additional information on what you are really trying to do (don't try to give us a "simple" version unless that is the result you really want), we can probably offer some additional guidance.
  4. I just posted a script that I think does what you want in the Vectorscript Share forum. https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=203432Post203432 Please test it and let me know if it works for you.
  5. The following script was requested by a user to move all Space objects, Doors and Windows in a drawing to a height of 0 (zero) relative to the layer they are on. Procedure SetZHeight; {Sets the Z Height of all Space Object, Doors and Windows} {in a drawing to 0 (Zero) relative to the layer they are on} {Use at your own risk on a copy of any critical data.} {Do not use while operating heavy equipment} {All warranties expressed or implied are null and void upon} {reading this disclaimer} {May cause dizziness, dry mouth or heat palpitations.} {Use only under guidance of a physician} {October 7, 2014} {© 2014, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} Procedure SetSpaceZHeight(SSZHand:Handle); Var ZHeight: Real; OldName: String; TempName: String; Begin TempName:=Date(2,1); OldName:=GetName(SSZHand); SetName(SSZHand,TempName); ZHeight:=ZCoordinate(N=TempName); Move3DObj(SSZHand,0,0,-ZHeight); If OldName='none' then OldName:=''; SetName(SSZHand,OldName); End; Begin ForEachObject(SetSpaceZHeight,(((PON='Space')|(PON='Door')|(PON='Window')))); End; Run(SetZHeight);
  6. You need to decide what the maximum value you are going to handle is before you start trying to write code to convert to base26. The code will probably be very different if you only need to go to ZZ instead of ZZZ. You will have to determine each letter separately and then use Concat to put the string together.
  7. Are you going to have more than 26 objects? If not, then you can use SetRField(H2,MyRec,MyField,CHR(64+NextNum); If you want lowercase use 96+NextNum If you are going to have more than 26, what should come after Z?
  8. There is no SumIf function, but you can use the Count outside of the database rows and give it a criteria that will only give you the objects you are looking for something like: =count('MyRecord'.'MyField'='Type1'); The other option is to split it up and create three different database section one for each type and then do the counts from there.
  9. What are you actually trying to do? If you want to set a field in a record, especially if you are OK with doing it by stacking order, you don't need a sort function. I post a script to write data into a record a few days ago. See https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Main=40740&Number=203171#Post203171 If you can describe what you really need, perhaps I can modify this to do what you want.
  10. The diagonal lines look like you have some open and some closed polygons. If you don't have a closed poly, VW will make an extra edge to close it and fill to there. It looks to me like the circular room is made up of at least four or five separate polygons/polylines. If this is the case, try making sure the end points are coincident and then Add Polys.
  11. Send me a file showing some objects that need to be zeroed and I will work on it later today/tomorrow.
  12. Jim, Text sizes, not line thicknesses. I can see how to set them as Points, MM, or Inches, but in the OIP and the Text Menu, they alway display at Points. Pat
  13. I don't think there is an easy way to do this. The only thing that I can find is an extremely long formula (see below). I purposely left of the Hopper window type so you can test and see what happens with a missing type. You could add it at the end with another IF statement before the ,F4 and an extra parenthesis at the end. I used upper case in both the criteria and result sections of the IF because that way I could copy/paste a single value instead of two different values. I would add a new column G after the current sash operation and paste in the function. Format it to match the rest of the worksheet and hide column F (set the column width to zero). This will only work for functions with a fixed number of options. There is no way to capitalize random text that has been typed into a record. I think worksheets are being reworked for a future version, but this is the best I can offer for now. =IF((F4='OPENING'), 'OPENING', IF((F4='CASED OPENING'), 'CASED OPENING', IF((F4='FIXED GLASS'), 'FIXED GLASS', IF((F4='SINGLE HUNG'), 'SINGLE HUNG', IF((F4='DOUBLE HUNG'), 'DOUBLE HUNG', IF((F4='CASEMENT'), 'CASEMENT', IF((F4='BI-PARTING CASEMENT'), 'BI-PARTING CASEMENT', IF((F4='HORIZONTAL SLIDER'), 'HORIZONTAL SLIDER', IF((F4='AWNING'), 'AWNING', IF((F4='TILT/TURN'), 'TILT/TURN', IF((F4='VERTICAL PIVOT'), 'VERTICAL PIVOT', IF((F4='PICTURE WINDOW SLIDER'), 'PICTURE WINDOW SLIDER', IF((F4='CUSTOM'), 'CUSTOM', F4)))))))))))))
  14. Page based symbols are intended to display at the same size regardless of the layer scale they are on. You might want this for something like a title block or an annotation symbol. World based symbols are intend to display at their "real" size regardless of the page scale. This is for objects like doors, windows, furniture, etc. Different settings for different purposes.
  15. ,database is the easy way to do other things easy Pat. Yes, database is the best way to do many things. For me the biggest trick is realizing that you have to put the data into a record to get it to display. If you need to add notes, add a record.field to the object and type away in the database. If you need to add a custom multiplier, again add a record.field and enter whatever you want, either from the worksheet or from the OIP. You can even have just one record format with different field for different uses and ignore the ones you don't need. Pat
  16. No easy way to do a database. Databases can only show information that is default for the object or that is stored in a record. That record can be a PIO record that is part of the creation information of the record (door.width), or it can be a custom record that you have made and attached to the object. The following script will sequentially number (based on stacking order) all of the objects in a drawing with a Record named Test with a Field named Seq. You could then pull that information into a database by using a formula of ='Test'.'Seq'. The quotes are only necessary if you use record or field names with spaces in them. You can change the record and field names by chaining the definitions in the Const section of the script. Procedure Number_Objects; {October 1, 2014} {? 2014, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} const MyRec='Test'; MyField='Seq'; Var NextNum: Integer; Procedure MyProc(H2:Handle); Begin SetRField(H2,MyRec,MyField,Num2Str(0,NextNum)); NextNum:=NextNum+1; End; Begin NextNum:=1; ForEachObject(MyProc,((R IN [MyRec]))); End; Run(Number_Objects);
  17. Worksheets are similar, but also unsimilar to Excel. To fill a range of cells, rather than use the FILL commands in Excel, select the cell you want to duplicate and copy it. Then select the range of cells you want filled and paste. The data will be pasted into each cell. If you have multiple cells selected before the copy, it will repeat that set of sells in the selected paste area. For numbering, create two cells. The first has the number 1 in it (assume A2 is the cell). The second has a formula of =A2+1. That would be call A3. Select cell A3 and copy it. Select Cells A4-A10 and paste. The formulas will update for each cell and you will get a list of number from 1 to 9. Pat
  18. The BREEDTE and HOOGTE are available, but my guess is they will return the same as the Height and Width in the English version and give you the values for the bounding box, not the rectangle width and height as shown in the OIP. Can you check and see if this is the case? Just a rectangle, duplicate it and rotate it. See what values you get in the worksheet. I would love it if the Dutch version is returning the "correct" values. It will make getting it turned on the English version much easier.
  19. I did, it just took me an extra two months to notice the thread ;-) Actually, when I as answering, I did not notice that the original question was from July. Sorry about the delay. Pat
  20. I did, it just took me an extra two months to notice the thread ;-) Actually, when I as answering, I did not notice that the original question was from July. Sorry about the delay. Pat
  21. I did, it just took me an extra two months to notice the thread ;-) Actually, when I as answering, I did not notice that the original question was from July. Sorry about the delay. Pat
  22. Don't overcomplicate things. The following is adapted from my history of the Vectorscript mail list and the notes on CreateDuplicateObject from developer.vectorworks.net. Make sure you read Charles' note at the bottom of the entry. Thanks to Charles Chandler, Julian Carr and Gerard Jonkers. Procedure Test; var H1,H2: Handle; Begin H1:=FSymDef; H2:=CreateDuplicateObject(H1,GetParent(H1)); If H2 <> Nil then SetName(H2,'Duplicate Symbol'); Message(Date(2,2),GetSDName(H2)); End; Run(Test);
  23. I just posted an example script on the Vectorscript Sharing forum. https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=202373Post202373 Note that this has the same limitations as the rest of VW when it comes to how rectangles are oriented. If your rectangles are rotated after you create them, the Width and Height may not be what you expect them to be, but the two values will be correct.
  24. There is some information on objects that is easily accessible from Vectorscript that is not available in a worksheet. One example of this is the Height and Width of a rectangle. This script reads the Height and Width of a rectangle and stores that information into a record so it can be accessed from a worksheet. The information is not dynamic, so if a rectangle changes size the script needs to be run again. NOTE: VW has a strange definition of Height and Width. They are based on how the object was originally drawn, not on how it is currently rotated on screen. This script only reports the data as shown in the OIP. It could be extended to take rotation into account. That is left as an exercise for the student. This could be easily be expanded to handle other object types and/or other object data to store in other fields. Before running this script, create a Record Format in the file named RectRecord with two fields named RWidth and RHeight. The fields should be created a Numbers and formatted as Dimension. Create and select some Rectangles in the drawing and run the script. Procedure Rect_Dims_to_Record; {Attaches a record to any selected Rectangles that do not have the record attached} {and stores the rectangle height and width into that record.} {Must be rerun any time the dimensions of a rectangel change.} {Written to provde the hgiht and withs of a rectangle in a form} {accessible in a worksheet.} {Sept. 19, 2014} {? 2014, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {Use at your own risk. Look both ways before crossing.} {Due to the risk of water pollution, use this, and all, scripts} {at least 100 meters from natural waterways. } Const {Change the constants here to reflect the Record Format and Field Names you are using} RecName='RectRecord'; WidthField='RWidth'; HeightField='RHeight'; Var RectHandle: Handle; {Handle to the current object we are working with} FullHeight, FullWidth : String; {Need to use a single variable to hold the rec.field} Begin RectHandle :=FSActLayer; {Get the first selected object} While RectHandle <> Nil do {Repeat until all selected objects have been handled} Begin If GetType(RectHandle)= 3 then {Check if object is a rectangle} Begin {If it is a rectangle then...} SetRecord(RectHandle,RecName); {Make sure the record is attached} SetRField(RectHandle, RecName, WidthField, Num2StrF(HWidth(RectHandle))); {set width} SetRField(RectHandle, RecName, HeightField, Num2StrF(HHeight(RectHandle))); {Set Height} RectHandle:=NextSObj(RectHandle); {Move on to the next selected object} end Else {If the object was not a rectangle} Begin RectHandle:=NextSObj(RectHandle); {Move on the the next selected object} End; End; End; Run(Rect_Dims_to_Record); Use at your own risk. No rights reserved.
  25. Vincent, That might be easiest if you only have on file. If you have multiple files of resources, then the Batch Convert command is much easier. You can have it rename either the original or the new files.
×
×
  • Create New...