Jump to content

Conrad Preen

Vectorworks, Inc Employee
  • Posts

  • Joined

  • Last visited

Everything posted by Conrad Preen

  1. If you aren't sure how to use these scripts in your document, here's a link to the help 😉 https://app-help.vectorworks.net/2022/eng/VW2022_Guide/Scripts/Creating_and_editing_script_palettes_and_scripts.htm?rhhlterm=add script scripts scripting&rhsearch=add a script What I've posted so far is in the Vectorscript language which is a dialect of Pascal. Vectorworks can also use Python as a scripting language. Python has an enormous range of external libraries that let your scrips do all kinds of things like getting data from websites for example. Obviously that's complicated but even if you script a set of repeated actions you normally do by hand you'll be amazed at the time you save. Conrad
  2. Wonder how these work? Have a look at developer.vectorworks.net in the Function Reference section there are lots of examples for each function. C
  3. Another one. Copies the user1 param from device objects to equipment. PROCEDURE SyncUserParam; FUNCTION GetFirstDeviceParamValue(h:HANDLE):BOOLEAN; VAR paramvalue:STRING; devicename:STRING; PROCEDURE callback(h:HANDLE); BEGIN SetRField(h, 'EquipItem', 'user1', paramvalue); END; BEGIN IF (GetTypeN(h) = 86) & (GetName(GetParametricRecord(h)) = 'Device') THEN BEGIN paramvalue := GetRField(h, 'Device', 'user1'); devicename := GetRField(h, 'Device', 'name'); ForEachObject(callback, (((R IN ['EquipItem']) & ('EquipItem'.'name'= devicename)))) END; GetFirstDeviceParamValue := FALSE; END; BEGIN ForEachObjectInLayer(GetFirstDeviceParamValue, 0, 1, 1 ); END; Run(SyncUserParam);
  4. Here's the first one. Rename device AND equipment. Helps you out when the client tells you that you must rename all your devices and you've already begun laying out physical equipment. Just create a document script and past the text below into the script editor. OK, so it looks like some help is needed. Here's how it works. Say you have a device and an equipment item named 'MyDevice' and you want to change them both to 'YourDevice'. Then run the script. Type 'MyDevice' into the Find box and 'YourDevice' into the Replace box. Click OK. When I did this it changed both the equipment and the device called 'MyDevice' into 'YourDevice'. If it can't find any device or Equipment with the Find name then you get the alert saying that it can't be found. Enjoy! C PROCEDURE renameDeviceEquipment; CONST {Alignment constants} kRight = 1; kBottom = 2; kLeft = 3; kColumn = 4; kResize = 0; kShift = 1; VAR dialog :LONGINT; result :INTEGER; this: STRING; that: STRING; PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT); BEGIN GetItemText(dialog, 5, this); GetItemText(dialog, 7, that); END; PROCEDURE renameEquipment(h:HANDLE); BEGIN SetRField(h, 'EquipItem','name', that); ResetObject(h); END; PROCEDURE renameDevices(h:HANDLE); BEGIN SetRField(h, 'Device','name', that); SetRField(h, 'Device','tag', that); ResetObject(h); END; BEGIN dialog := CreateLayout('Rename Device and Equipment', false, 'OK', 'Cancel' ); CreateStaticText( dialog, 4, 'Find', -1 ); CreateEditText(dialog, 5, 'this', 24); CreateStaticText( dialog, 6, 'Replace', -1 ); CreateEditText(dialog, 7, 'that', 24); SetFirstLayoutItem(dialog, 4); SetBelowItem( dialog, 4, 6, 0, 0 ); SetRightItem( dialog, 4, 5, 0, 0 ); SetRightItem( dialog, 6, 7, 0, 0 ); AlignItemEdge( dialog, 5, kLeft, 1, kShift ); AlignItemEdge( dialog, 7, kLeft, 1, kShift ); IF RunLayoutDialog(dialog, Dialog_Handler) = 1 THEN BEGIN result := Count((((PON='Device') | (PON='EquipItem')) & (('Device'.'name'= this) | ('EquipItem'.'name'= this)))); IF result= 0 THEN AlertCritical('no devices or equipment found', 'check that the Find value is correct'); ForEachObject( renameEquipment, (5 & NOTINREFDLVP & ((PON='EquipItem') & ('EquipItem'.'name'= this)))); ForEachObject( renameDevices, (5 & NOTINREFDLVP & ((PON='Device') & ('Device'.'name'= this)))); END; END; Run(renameDeviceEquipment);
  5. Hi everyone! I've started this topic as a place to post any scripts that are handy for ConnectCAD. These will all be unlocked and free for you to edit and hack around to fix other problems. Conrad
  6. Hi @Ben59 Could you PM me the file so I can see? Conrad
  7. @darrancummins Hi Darran, I'm putting this subject on my list of things to look at. If we tackle punchdown blocks I want do it properly. The Krone solution I developed years ago was based around my own specific design workflow i.e. no flexibility in labelling / cable numbering etc. Good for me but maybe not for you. As Vectorworks, we have to do this properly or not at all. For now you can do this with custom devices. I understand that isn't a complete solution. The reason the old Krone tools never made it into the current versions is because I had every indication that no-one in AV was using them any more. In fact when I did a poll before retiring them the majority response was "what's that?". But I'm a big fan of these systems. So, if I can see some demand we will work on them. Conrad
  8. Oh I'm glad you asked that! I used to love Krone blocks for audio and then people stopped using them. Back in the day we had a whole extra workflow for these including visualising the layout of the blocks in their frame. What field are you working in? I'm sure we can re-vitalise these if there's a demand for it. Best Conrad
  9. My 2c worth... Park your spare circuits on externals. You can then re-purpose them at a later stage. If you name the externals SPARE 1, SPARE 2 ... then you can easily see then in the list. Externals represent the world outside your system - those cables that go to other places but need to be documented. Externals treat the outside world as a device named <EXT> with sockets named with your External Name. But you can also assign External to Drop Points (the physical locations where a bunch of cables is delivered) using the Name popup in the Object Info Palette. That way they can be included in the cable path model too and you can extract the length of the cables. Hope I've helped. Conrad
  10. OK we resolved this. Just for information, schematics would normally be viewed in 2D Top/Plan view. But we don't place any restrictions on viewing them in any 3D view. I've often found that for presentations showing a schematic diagram at a funky angle adds a bit of zing! In this case we're looking at Top view. So, why is the text rotated? Basically because the circuit in question was drawn from right to left. So why is it ok in Top/Plan. That's because ConnectCAD follows the Adjust Flipped Text preference and automatically rotates the text in this view. However Vectorworks doesn't adjust flipped text in 3D views because it isn't really possible to guess what the user really wants in this case. So that's the explanation of the flipped text. I wasn't able to see the half masked device name on my system so this may have to do with fonts or something. If it re-appears be sure we will follow it up. Thanks! Conrad
  11. Hi @Dendecko If you like, please PM me the file in question and I'll have a look. Conrad
  12. Hi Kevin, Thanks for the commentary. I actually wasn't aware of this new article ( there being only 24 hours in my day 🙂 ). We'll look into it. Appreciate your feedback. Conrad
  13. Hi @Finian Could you PM me your email and your old licence details and I'll forward the message to our Sales department? Best Conrad
  14. Hi @sivonen Could you send us a file that shows the issue? Conrad
  15. I'll be doing the Open House in the (US) morning and in the afternoon Scott and Nick will be taking care of you. Stop by and I'll show some useful tips. Conrad
  16. @Dendecko You can get Vectorworks to redraw the screen by double-clicking the pan tool. But we will check your file too and see what's going on. Conrad
  17. Well there is a place for a suite of power scripts. And you can always create these as Vectorscript or Python plug-ins. I'm not as in touch with the scripting community as I used to be and the websites come and go. But Google can find them and there's quite a lot of resources and examples out there. I will certainly help support anyone wanting to develop scripts for ConnectCAD. Conrad
  18. Thanks @Ross McLee we're checking that.
  19. @Ross McLee In this thread we are talking about 2 different things: reporting, and circuit/connect tool operation. And I get what you're saying. Back in the day my installation manager used to take the lists I sent him into Excel and sort and filter them by location so as to share the work between installers. Vectorworks worksheets aren't quite as powerful as Excel but you can still do a lot. For example, you can change the criteria to filter for particular locations, you can sort by up to 3 columns. You're by no means stuck with what we give you. But let's face it, it's not Excel and re-inventing the spreadsheet seems a bit pointless when Vectorworks can import and export Excel files directly. Circuit source and destination reflect signal flow where this is one-way. I don't like the idea of changing that because it will kill off some ideas I have for the future. As far as swapping over IO-IO circuits goes - yes could be done but this would be a great little script project. Grab the path of a selected circuit and all it's parameters, delete it and re-create the circuit the other way around. I don't really like cluttering up the OIP with a Swap button that is only enabled for Io-IO circuits. ConnectCAD is confusing enough for new users, I want to simplify it. My 2c worth Conrad
  20. @ryanww Ah yes I get the picture. You don't need Architect to do these kind of drawings. But ConnectCAD isn't aimed so much at residential electrical installations. It's a bit of a sledgehammer to crack a walnut. That said, you can place Equipment Item objects on your ceiling plan and those can have any look you want. If you have a symbol you want to use for the look of the Equipment item just create the basic equipment object, and in the Object Info Palette select Use Symbol and choose the symbol you want. Give the Equipment item the same name as your schematic device and they are linked. You don't have to do this rigmarole every time - you can save the Equipment Item set up the way you want it as a red symbol (Create Symbol command) and just drag it in from the Resource Manager. Create Equipment also helps automate creating an equipment item for each distinct device name on your schematic. You can place Drop Points in your ceiling at the points where cabling is delivered. And link these up with Cable Paths created with the Cable Route tool. Link each equipment to the drop point used to cable it (using the control point on the object). Then run the Analyse Cable Routes command to look for a physical route for the theoretical circuits in your schematic drawing. Once you have a routing for your circuits Calculate Cable Lengths will work out the length of each circuit. You can also use the Spotlight Cable object to draw the cabling directly, and ConnectCAD gets it. Assign the Cable Run ID in the Circuit.Cable parameter and the length of the theoretical circuit is set to the length of the selected Cable object. Calculate Cable Lengths will update the length if you make changes. Hope that helps a bit. It is overkill for a simple architectural electrical plan but when you have several thousand cables to route it becomes really useful. Goes without say that I'm looking for ways to fill the niche with a simplified workflow that can exist in parallel with the complex one. Best Conrad
  21. @ryanww Hey Ryan, Help me out with that TLA (three-letter-acronym) please... what does RCP stand for in your part of the world? Thx Conrad
  22. @the_fisher Well I have checked out what I can glean from the above and %g seems to work as designed. %g looks at the entire cable number and checks that it is unique. So if the sockets in your device all have unique names (a good thing) then %g will not need to increment because each combination of <socket name>+ number is unique. If you want a number that increments each time the tag is used then you should use the %u tag. Hope I've answered the question. Let me know if I have missed something. Best Conrad
  23. @the_fisherInteresting. Can you give me a more complete example to try? If you Edit As Text... you'll be able to copy the complete rule e.g. Src_Dev_Name^?JF_&Src_Skt_Name^PORT=%s#1#2 That way I can try it out and let you know. Conrad
  24. Hi @Thomas K., What I still haven't really understood here is the "why" of this request. What happened? What was the source of the confusion? I feel like we've jumped straight to a possible solution without including me in understanding the problem. Feel free to PM me if you prefer. Conrad
  25. Hi @Thomas K. Hiding stuff on design layers like this may introduce a gotcha. Say you hid unused sockets and then life being what it is you got dragged away to some other task and a few weeks later you come back to it. What are the chances that you'll forget that you hid those sockets? And if that happens an you need one of them and go create the same socket in name - then Check Drawing will fail mysteriously until the penny finally drops. Perhaps the best approach would be for use to provide a somewhat hidden connection count parameter for sockets that could be used in a script to change the class as Niko suggests or allow you to delete unused sockets? Conrad
  • Create New...