Jump to content

James Russell

Member
  • Posts

    391
  • Joined

  • Last visited

Everything posted by James Russell

  1. Micheal, I have done so with scripts in the past but was hoping for a really crafty way to do it within a worksheet cell. I know there's some strays in the VW device library but I have an idea that I'll have to try tonight. I'll see if I can change the Weight field in the lighting device xml to be a General integer with a trailing unit of kg, which is what I used to do in the past for appearance in my worksheet. Then seeing if VW will interpret the figures within the Light Info Record as integers with tags rather than text. It might just crash though translating the data across, guess we'll see. Otherwise you're probably right, I might just make a script with a ForEachObject loop taking out any letter components from the Weight field string and leaving the numbers and then just run a VALUE() over the whole field in the worksheet. I'll let you know how I go breaking things. J
  2. Hey all, I want to analise the weight field of a Lighting Device as a value but I don't want to change the entire device library to do so. The current Lighting Device states the weight field as a 'Text' field so an example of weight is '11.3kg' as text. I want a worksheet formula which calculates the overall length of a field in characters, subtracts 2 places from the tail end and then converts it to a numerical value. A similar formula from Excel/Numbers would look like: =VALUE(LEFT(A1,LEN(A1)-2)) Where field A1 contains the subject number with kg on the end, eg. '23.56kg' In my mind an easy translation to the header field of a worksheet with a database lookup for =DATABASE((R IN ['Lighting Device'])) would be: =VALUE(LEFT(('Lighting Device'.'Weight'),LEN(('Lighting Device'.'Weight'))-2)) Unfortunately the LEN() and LEFT() functions do not exist in VW. Does anyone have an idea to move forward? If not collaborative discussion time? Cheers, J
  3. Also behind you both on this one. On a similar note I would like the option when my dongle for VW is knocked out of a USB port I could get an option to SAVE my work rather than immediately quitting. J
  4. I've been looking at the 3DConnexion products for years but have always hesitated due to compatibility issues. I'll be watching with anticipation, J
  5. Thanks guys, Great responses and examples. Cheers, J
  6. Hey all, Just wondering how I write the following IF statement. At the moment I have: IF (CkCnt=TRUE OR CkAll=TRUE) Then Begin End; Where CkCnt and CkAll are Booleans. I'm probably just missing a comma or bracket or semisomething or sleep. Any help appreciated. Cheers, J
  7. Awesome! I guess rounding up could be achieved quite easily with =(x+1) DIV 1 anyways. ;p Thanks. J
  8. Michael, I had come to a similar solution last night but hadn't thought of moving the Value out, that's great! It's used in paperwork for two scenarios, one as you suggested in the theatrical world for subsidiary items such as bar extension on truss and counter-leavered arms. Secondly in the commercial exhibition world with custom created track layouts. I wrote a script a while ago that creates single and three circuit track as a lighting device from double-line/polygons which is great but there are some layouts such as figure-8 patterns that cannot be created from one loop of track, therefor the breakdown of 1.1, 1.2, 1.11, etc. This way the items of track can be identified independently but counted as a whole if needed. I just had a look at the help for the DIV function, does it always naturally round down? Cheers, J
  9. Thanks for all the great replies guys! Late last night I managed to convert Booleans to Integers but hadn't yet linked that to a function. This is the solution! Cheers, J
  10. Hey all, I have a script which looks great but has little execution. I have a lovely dialog which has 10 checkboxes. When each of these are checked or not checked they save their data as a Boolean to 10 different Booleans labelled, ChkA, ChkB all the way to ChkJ. My question is what is the easiest way I can tally these up to find out how many are checked? I don't need to know which ones are checked just the total overall of how many are checked out of the ten and pop that number into an integer. Happy coding! J
  11. Thanks Pat. I'm always missing parenthhesis all over the place. So that formula now works! Just so you know the background too all these is that I'm bringing a whole heaps of templates forwards to 2013. Last step, promise. I've now got a formula from my old template: =IF((('Lighting Device'.'Position')=''), 0, ROUND(VALUE(('Lighting Device'.'Position'))-0.499)) In this situation the 'position' can only be entered as a number and the worksheet rounds it down to the nearest whole number, a formula I believe you helped me with years ago Pat. Working my way up to here I find that; =IF((('Lighting Device'.'Position')=''), 0, ROUND(VALUE(('Lighting Device'.'Position'))-0.499)) Works with rounding but returns #Value errors for blank cells. =IF((('Lighting Device'.'Position')=''), 0, ('Lighting Device'.'Position')) Works but shows decimals places. =IF((('Lighting Device'.'Position')=''), 0, VALUE(('Lighting Device'.'Position'))) #Value errors on blank cells, unrounded numbers on filled cells. =Any combination with ROUND() without VALUE() Fails with odd numbers presumably because 'Position' is a Text field. If someone gets a chance to check this over it'd be quite grateful, I'm just going in circles at the moment. Cheers, J
  12. Even though I feel like I'm having a conversation with myself (not unlike usual!) I've made a few interesting discoveries with the new Lighting Device that others might be interested in. Once a custom Lighting Device has been created it generates an xml file located within the user library; User>Library>Application Support>Vectorworks>2013>Plug-ins>Data. This file is the preferences file containing data for the field types and misc variables for the Lighting Device plugin, replacing the old Lighting Device.vso. Within each of the fields you'll find a single variable. In my case I've found pesky things like Unit Number as Text (kfieldText) and replaced it with and Int (kfieldLongInt) in my case. This still appears to be a locked value by the over GUI component of the Lighting Device but seems to operate as normal at this stage. Unfortunately I still haven't found a way to add Pop-up list options to the Lighting Device and although I can create them through the xml file I can't seem to add listing options at this stage. Obviously if you're going to text this along with me backing up files and using at your own risk is important here. I'll let you all know how it goes! Still working on the post above, let me know if you have ideas!
  13. I've solved my own problem to a degree but it raises another issue. The field for 'Unit Number' as defined by the Spotlight Document settings>Lighting Device properties is a Text field. By inserting the VALUE() command around ('Lighting Device'.'Unit Number) the IF statement returns a correct result. Unfortunately this field is locked and cannot be changed without editing the xml file... (I'm working on it right now ) On another column over though I want to test an ISBLANK equivalent on my positions. About half of my lamps have a position, half have nothing in the field. Following the help example for IF statements: if (logical_test, value_if_true, value_if_false) I put in the formula =IF('Lighting Device'.'Position')='', 'BLANK', 'NOT BLANK') To my surprise the formula disappears and is replaced with =('Lighting Device'.'Position')='' to which all fields reply with a true or false not my text as requested. Ideas...?
  14. Hi all, I've struck a problem jumping between 2010 and 2013, just want to see if someone can replicate it. I've got a worksheet listing several Lighting Devices with unit numbers from 1 to 200 in this example. So the database search criteria is =DATABASE((R IN ['Lighting Device'])) meaning all lights are picked up. So there's 200 line items now and I'm putting a formula into cell A1 which will define the whole column's formula. =('Lighting Device'.'Unit Number') This gives me the numbers 1 through 200 as I expect. Now I do the same in B1. I've chosen an if statement which I thought used to work: =IF(('Lighting Device'.'Unit Number')>50, 'Greater than 50', 'Less than 50') But alas all the results returned are 'Greater than 50', when I would expect the first 50 in this example to say 'Less than 50'. Other operations that I still have in templates like ROUND() and VALUE() are working yet IF doesn't seem to. Can someone replicate/investigate/solve? Cheers, James
  15. Hi all, It's been a while but I finally made it back to the forums. Had and interesting question from a student today and I couldn't find the answer. The question is: When we're in a Top/Plan view you can clearly see the infinite active layer grid, and when we move to a 3D isometric view it is present there as well but restricted, not infinite. Is it possible to extend this grid to either a larger size or make it infinite? Hope you're all well. J
  16. I was just doing a whole heap of distance calculations and had never used LONGINTs before now. Used them when I realised that it was levelling out on higher number sets. Is there a low limitation to using LONGINTs more often? What are the advantages/disadvantages? Presumable they are slightly larger data wise which may cause an accumulative slow down in loops... But what else do they do? J
  17. Just left it as an Integer, works quite well.
  18. You've been memorising a fair few functions hey? Worked like a charm. I thought I'd seen Pat do a topic on those a while ago but I could be mistaken. J
  19. Also, INT as a function doesn't seem to agree in one of my current script lines: ABSSTR:=Concat(((INT(3.14/5)*5)+5),'m'); Declaring that INT is not declared as an identifier. Is there an alternative for running in scripts? 3.14 is an example substitute for a much longer formula but the error resultant is the same. J
  20. Michael, Your math logic rocks my layer plane. J
  21. Hey all, Database header formula for rounding upwards to the nearest multiple of 5. Ideas? Cheers, J
  22. Ahh! I see! Respect to that. *runs away to test* Thanks. J
  23. WhoCanDo - Totally agree. I did have a ForEachLoop in the first revision but I'll explain more in a sec. Pat - I'm actually a fan of the triple ' . I enjoy the challenge of deciding between single, double, triples and quads. You're right though, I'll condense a few bits in a sec. Josh - I'm only just really getting handles. It's taken a VERY long time for me to even start using them in my scripting. I'm revising a lot of my older stuff to include ForEach.. in them. I think the overall issue here might not relate to the SelectObj part of the script and more to what happens after, if you're not on the current layer. From my experience thus far any of the select commands select across all layers. I'm then using the FSActLayer to grab and save the handle of my selected object (Dimmer) for later use. The issue for me is what if it's not on the active layer, either on a different layer or a hidden layer, what is the call to allow me to get a handle to the object, FSSelectionAcrossAllLayers? Thanks for the help thus far though, loving the scripting love. J
×
×
  • Create New...