Jump to content

Julian Carr

Distributor
  • Posts

    289
  • Joined

  • Last visited

Everything posted by Julian Carr

  1. I totally agree Pat. Even though Pascal is verbose compared to Python and doesn't have the same community support or external libraries, it requires special knowledge to understand the syntax. Anyway thanks to you I figured a way to do it, though it only works with files in metric units. If you draw a Space, leave it selected the run this script, you will see the desired criteria string: perimValueStr = vs.GetRField( vs.FSActLayer(), 'Space', 'Perim' ) (Flag, perimValue) = vs.ValidNumStr(perimValueStr) #convert notation string to real number perimValueStr = format(perimValue, '.4f') #convert real back to string to 4 decimal places crit_ = "('Space', 'Perim' = "+ perimValueStr + ")" vs.Message(crit_)
  2. Nice try Pat. It still produces an error. It doesn't like the 'f'. Run this snippet to see it: widthValue = '9e02' format(widthValue, 'f') vs.Message(widthValue)
  3. Well I guess you are correct Pat, and thanks for your reply. It is already a number expressed in scientific notation, but that can't be used in a criteria string. This is the error it gives: Error: Unable to parse Search Criteria. Database(('Space'.'Perim' = 9e02)) so I need a way to change this: perimValue = 9e02 to this: perimValue = 900 Any ideas on that one?
  4. Sometimes when you use GetRField() to return a dimension value from a PIO, it returns the value in scientific notation, so a value of 900 (mm) becomes 9e02. You can use Str2Num('9e02') to convert this to a real number, however this does not work in python and produces this error: Type Error. Can't convert 'float' object to str implicitly. Here is a code snippet: perimValue = vs.Str2Num(vs.GetRField( h, 'Space', 'Perim' )) crit_ = "('Space'.'Perim' = "+ perimValue + ")" vs.ForEachObject(DoIt, crit_) The equivalent in Vectorscript works OK. Thanks for any ideas. Julian
  5. I think I worked it out but the result is odd. Using GetVectorFill() you can get the name of the fill. Then using GetType(GetObject(FillName)), you get the object type as follows: Hatch: 66 Tile: 108 Image: 119 Gradient: 120 Here is the test code I used, which works on the fill of the selected object: Procedure T; VAR h : HANDLE; s1 : STRING; n : LONGINT; Flag : BOOLEAN; BEGIN h := FSActLayer; n := GetFPat( h ); s1 := Index2Name(n); Flag := GetVectorFill(h, s1); message( n , ' ', s1, ' ', GetType(GetObject(s1))); END; Run(T);
  6. Anyone know how to get the type of fill (hatch, tile or image) associated with an object? I know that GetFPat() will return a negative number for these fill types and you can get the name of the fill using GetVectorFill(), however this doesn't give you the fill type. There must be a way?? Thanks, Julian
  7. This works for me in many cases: FOR i := j DOWNTO 0 DO RemoveChoice(gDialog1, 29, i); Perhaps you need to go backwards? Julian
  8. The only way to achieve this would be to move the symbol instance into the profile group of the PIO, then copy the 3D components from that symbol instance into the PIO. You could do this by cycling through all the objects in the symbol, duplicating anything that is 3D (use GetType()), then using SetParent() to move it from there to the PIO. If the symbol contains planar objects, then you will also need to check if 2D objects are planar and if so, duplicate and move them as well. Julian
  9. Thanks for your reply. To elaborate, I have an event enabled object on a layer (sheet or design). The object has a hidden parameter that contains a unique ID generated using CreateUUID. This name is also given to a locus within the object's profile group. When the layer is duplicated, the locus loses its name and the unique ID field is no longer unique. This can be problematic down the track. If the object could detect its creation, it could rectify this and generate a new unique ID. Thanks for any ideas.
  10. Does anyone know if it is possible to detect an event if a design layer or sheet layer is duplicated? Thanks, Julian
×
×
  • Create New...