/3.0 (Extension.1 Name: "Cadtools Extension" FirstRootClassName: "List" Roots: 2 Roots: 4 Roots: 14 Roots: 78 Roots: 79 Roots: 80 Roots: 81 Roots: 82 Roots: 83 Roots: 84 Roots: 85 Roots: 86 Roots: 87 Roots: 88 Roots: 89 Roots: 90 Roots: 91 Roots: 92 Roots: 93 Roots: 94 Roots: 95 Roots: 96 Roots: 97 Roots: 98 Version: 30 About: "This extension provides more tools for working with CAD drwaings." InstallScript: 99 UninstallScript: 100 ExtVersion: 3 ) (List.2 Child: 3 Child: 3 ) (Nil.3 ) (List.4 Child: 5 ) (List.5 Child: 6 Child: 10 Child: 13 ) (List.6 Child: 7 Child: 8 Child: 9 ) (AVStr.7 S: "View" ) (AVStr.8 S: "ToolBar" ) (AVStr.9 S: "c_tran3.ave" ) (Tool.10 Disabled: 1 Help: "Allows interactive creation of a CAD theme world file." ObjectTag: 11 Update: "c_tranu3.ave" Icon: 12 Cursor: "Cursors.Bullseye" Apply: "c_tran3.ave" Click: "c_tranc3.ave" ) (Nil.11 ) (AVIcon.12 Name: "Box" Res: "Icons.Box" ) (Numb.13 N: 14.00000000000000 ) (List.14 Child: 15 Child: 22 Child: 29 Child: 36 Child: 43 Child: 50 Child: 57 Child: 64 Child: 71 ) (List.15 Child: 16 Child: 20 Child: 21 ) (List.16 Child: 17 Child: 18 Child: 19 ) (AVStr.17 S: "View" ) (AVStr.18 S: "CAD" ) (AVStr.19 S: "c_lay3M.ave" ) (Choice.20 Disabled: 1 Help: "Separates a CAD based theme into a single theme for each layer or level." Update: "c_cadu3.ave" Label: "Make CAD layers" Click: "c_lay3M.ave" Shortcut: "Keys.None" ) (Numb.21 ) (List.22 Child: 23 Child: 27 Child: 28 ) (List.23 Child: 24 Child: 25 Child: 26 ) (AVStr.24 S: "View" ) (AVStr.25 S: "CAD" ) (AVStr.26 S: "c_tx2p3.ave" ) (Choice.27 Help: "Captures text (annotation) from a theme and adds the value to the table of a new point shape theme." Update: "c_tx2pu3.ave" Label: "Text to point" Click: "c_tx2p3.ave" Shortcut: "Keys.None" ) (Numb.28 N: 2.00000000000000 ) (List.29 Child: 30 Child: 34 Child: 35 ) (List.30 Child: 31 Child: 32 Child: 33 ) (AVStr.31 S: "View" ) (AVStr.32 S: "CAD" ) (AVStr.33 S: "c_txinp3.ave" ) (Choice.34 Help: "Associates text with the AutoCAD polygon that surounds it." Update: "c_dwgu3.ave" Label: "Text in polygon (DWG)" Click: "c_txinp3.ave" Shortcut: "Keys.None" ) (Numb.35 N: 3.00000000000000 ) (List.36 Child: 37 Child: 41 Child: 42 ) (List.37 Child: 38 Child: 39 Child: 40 ) (AVStr.38 S: "View" ) (AVStr.39 S: "CAD" ) (AVStr.40 S: "c_blinp3.ave" ) (Choice.41 Help: "Associates block attributes or items associated with a point with the AutoCAD polygon that surrounds it." Update: "c_dwgu3.ave" Label: "Block in polygon (DWG)" Click: "c_blinp3.ave" Shortcut: "Keys.None" ) (Numb.42 N: 4.00000000000000 ) (List.43 Child: 44 Child: 48 Child: 49 ) (List.44 Child: 45 Child: 46 Child: 47 ) (AVStr.45 S: "View" ) (AVStr.46 S: "CAD" ) (AVStr.47 S: "c_txind3.ave" ) (Choice.48 Disabled: 1 Help: "Associates text with the MicroStation polygon that surrounds it." Update: "c_dgnu3.ave" Label: "Text in polygon (DGN)" Click: "c_txind3.ave" Shortcut: "Keys.None" ) (Numb.49 N: 5.00000000000000 ) (List.50 Child: 51 Child: 55 Child: 56 ) (List.51 Child: 52 Child: 53 Child: 54 ) (AVStr.52 S: "View" ) (AVStr.53 S: "CAD" ) (AVStr.54 S: "c_ptind3.ave" ) (Choice.55 Disabled: 1 Help: "Assocaites cell tags or items associated with points to the MicroStation polygon that surrounds it." Update: "c_dgnu3.ave" Label: "Point in polygon (DGN)" Click: "c_ptind3.ave" Shortcut: "Keys.None" ) (Numb.56 N: 6.00000000000000 ) (List.57 Child: 58 Child: 62 Child: 63 ) (List.58 Child: 59 Child: 60 Child: 61 ) (AVStr.59 S: "View" ) (AVStr.60 S: "CAD" ) (AVStr.61 S: "c_woff3.ave" ) (Choice.62 Help: "Turns off all world files for all CAD themes in a view." Update: "c_caduc3.ave" Label: "World files off" Click: "c_woff3.ave" Shortcut: "Keys.None" ) (Numb.63 N: 8.00000000000000 ) (List.64 Child: 65 Child: 69 Child: 70 ) (List.65 Child: 66 Child: 67 Child: 68 ) (AVStr.66 S: "View" ) (AVStr.67 S: "CAD" ) (AVStr.68 S: "c_won3.ave" ) (Choice.69 Help: "Turns on all world files for all CAD themes in a view." Update: "c_caduc3.ave" Label: "World files on" Click: "c_won3.ave" Shortcut: "Keys.None" ) (Numb.70 N: 9.00000000000000 ) (List.71 Child: 72 Child: 76 Child: 77 ) (List.72 Child: 73 Child: 74 Child: 75 ) (AVStr.73 S: "View" ) (AVStr.74 S: "CAD" ) (AVStr.75 S: "c_about3.ave" ) (Choice.76 Help: "Help and information about Cadtools extention." Label: "About Cadtools..." Click: "c_about3.ave" Shortcut: "Keys.None" ) (Numb.77 N: 11.00000000000000 ) (List.78 ) (Script.79 Name: "c_cadu3.ave" SourceCode: "'This is the update script for layu3.ave.\n'Available only if you have some cad files in view.\n\nisdrawing=false\ntheView = av.GetActiveDoc\n\nfor each x in theView.GetactiveThemes\n theSource=av.getactivedoc.findtheme(x.asstring).getsrcname.getsubname\n 'theftab= \n if (theSource <> \"\") then\n if\n \n (av.getactivedoc.findtheme(x.asstring).getftab\n.isdrawing)\n then\n isdrawing=True\n end\n end\nend\n\nSELF.SetEnabled(isd rawing) \n\n" ) (Script.80 Name: "c_tx2pu3.ave" SourceCode: "'This is the update script for txt2pt2.ave\n'Available only if you have an annotation theme.\nisdrawing=false\ntheView = av.GetActiveDoc\n\nif (theview.getthemes.count = 0) then self.setenabled(false) else\n\nfor each x in theView.GetThemes\n theSource=av.getactivedoc.findtheme(x.asstring).getsrcname.getsubname\nif (theSource <> \"\") then\n 'if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Annotation\") then \n 'if (((x.getsrcname.getname.contains(\"dxf\")).not)\n ' and ((x.getsrcname.ge tname.contains(\"dwg\")).not)) then\n if (x <> nil) then\n isdrawing=True\n end\n 'end\n end\n 'end\nend\n\n\nSELF.SetEnabled(isdrawing) \n\nend 'foreach\nend 'if" ) (Script.81 Name: "c_dwgu3.ave" SourceCode: "'This is the update script for DWG polygon activities.\n'Available only if you have dwg polygons in view.\n\nisdrawing=false\ntheView = av.GetActiveDoc\nif (theview.getthemes.count = 0) then self.setenabled(false) else\n\nfor each x in theView.GetThemes\n theSource=av.getactivedoc.findtheme(x.asstring).getsrcname.getsubname\n 'theftab=av.getactivedoc.findtheme(x.asstring).getftab\nif (theSource <> \"\") then\n if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Polygon\") then \n if (x.getsrcname. getname.contains(\"dwg\")) then\n isdrawing=True\n end\n end\n end\nend\n\nSELF.SetEnabled(isdrawing) \n\nend 'foreach\nend\n" ) (Script.82 Name: "c_dgnu3.ave" SourceCode: "'This is the update script for DGN polygon activities.\n'Available only if you have a dgn polygon in the view.\n\nisdrawing=false\ntheView = av.GetActiveDoc\nif (theview.getthemes.count = 0) then self.setenabled(false) else\n\nfor each x in theView.GetThemes\n theSource=av.getactivedoc.findtheme(x.asstring).getsrcname.getsubname\n 'msgbox.info (thesource.asstring,\"my source\")\n 'theftab=av.getactivedoc.findtheme(x.asstring).getftab\nif (theSource <> \"\") then\n if (x.getftab.isdrawing) then \n if (x.getsrcname.ge tsubname = \"Polygon\") then \n if (((x.getsrcname.getname.contains(\"dxf\")).not)\n and ((x.getsrcname.getname.contains(\"dwg\")).not) \n and ((x.getsrcname.getname <> nil)))\n \n then\n \n isdrawing=True\n end\n end\n end\nend\nSELF.SetEnabled(isdrawing) \n\nend 'foreach\nend" ) (Script.83 Name: "c_caduc3.ave" SourceCode: "'This is the update script for layu3.ave.\n'Available only if you have some cad files in view.\n\nisdrawing=false\ntheView = av.GetActiveDoc\n\nfor each x in theView.GetThemes\n theSource=av.getactivedoc.findtheme(x.asstring).getsrcname.getsubname\n 'theftab=\n \n if (theSource <> \"\") then\n if\n \n (av.getactivedoc.findtheme(x.asstring).getftab.isdrawing)\n then\n isdrawing=True\n end\n end\nend\n\nSELF.SetEnabled(isdrawing ) \n\n" ) (Script.84 Name: "c_wrodb.ave" SourceCode: "'This script will write an ODB for the active theme. It is intended to \n'be used with c_rodb.ave for use with \"complex 'CAD themes\", ie, \n'those comprised of a drawing file and a related table.\n\n'Added to CADTOOLS 9\\9 by ABS per request from Bill S.\n\n\n'Get the active theme\nmytheme=av.getactivedoc.getactivethemes.get(0)\npath=mytheme.getsrcname.getfilename.returndir\n\n\n'Get a new file name, but make a suggestion\nnewfilename=path.maketmp(mytheme.asstring,\"odb\")\nodbname=FileDialog.Put (newfilename, \"odb\", \"Save \")\n\n\n'Write the odb\nmyODB = ODB.Make(odbname)\nmyODB.Add(mytheme)\nmyODB.Commit\n\n\n" ) (Script.85 Name: "c_rodb.ave" SourceCode: "'This script will read in an ODB and add the first object so long as it's\n'an Ftheme. It is intended to be used with c_wrodb.ave for use with \"complex\n'CAD themes\", ie, those comprised of a drawing file and a related table.\n\n'Added to CADTOOLS 9\\9 by ABS per request from Bill S.\n\n\n'Show know obd files for selection\ntheodb=FileDialog.Show (\"*.odb\",\"ODB file\", \"Files\")\n\n'Ask for name for new theme\nthename=msgbox.input(\"Name for new theme?\",\"New theme...\",\"newodb\")\n\n'Open odb and find first object\nmyODB = ODB .Open(theodb)\natheme = myODB.Get(0)\n\n'If it's not an ftheme, say sorry and exit\n if (atheme.getftab = nil) then\n msgbox.info(\"Sorry, no theme found in ODB!\",nil)\n exit\n else\n theview=av.getactivedoc\n theView.AddTheme(aTheme)\n \n ' Set a new name for the theme...\n aTheme.SetName(thename)\n \n aTheme.InvalidateLegend\n \n ' Draw the theme...\n aTheme.SetVisible(true)\n end" ) (Script.86 Name: "c_tranc3.ave" SourceCode: "'this script is the click script for c_trans.ave, c_transu.ave\n'is the update script\n\n'get the drawing theme to be transformed\nthedrawthm = av.getactivedoc.getactivethemes.get(0)\nthedrawftab=thedrawthm.getftab\n\ntheView = av.GetActiveDoc\nif (1 = theView.GetActiveThemes.Count) then \ntheDrawing = theView.GetActiveThemes.Get(0).AsString\ntheSource=av.getactivedoc.findtheme(theDrawing).getsrcname\nend\n\n\nif (theSource.asstring.contains(\".dgn\")) then _CADTYPE=\".dgn\" end\nif (theSource.asstring.contains(\".dwg\")) then _CADTYPE=\".dwg\" end\nif (theSource.asstring.contains(\".dxf\")) then _CADTYPE=\".dxf\" end\n\n\n'Check to see if it has a world file already\nif (thedrawftab.returnworldfile <> nil) then\n theresponse = msgbox.yesno(\"Existing world file found!\"+nl+\n \"It will be turned off and overwritten?\"+nl+\"Proceed?\",\"World File Found!\",True)\n if (theresponse=false) then\n thegui=av.findgui(\"view\")\n thetoolbar=thegui.gettoolbar \n thetoolbar.selectdefault \n exit \n else 'if it has a world file t urn it off\n if (thedrawftab.isworldfileenabled = true) then \n theview=av.getactivedoc\n thethemelist=av.getactivedoc.getthemes\n for each x in thethemelist\n if (x.getftab.isdrawing) then\n 'w=x.getftab.returnworldfile\n x.getftab.setworldfileenable(false)\n end\n end\n theview.invalidate\n\n 'zoom to new extents - no world file\n av.GetProject.SetModified(true)\n theView = av.GetActiveDoc\n t heThemes = theView.GetActiveThemes\n r = Rect.MakeEmpty\n for each t in theThemes\n r = r.UnionWith(t.ReturnExtent)\n end\n \n if (r.IsEmpty) then\n exit\n elseif ( r.ReturnSize = (0@0) ) then\n theView.GetDisplay.PanTo(r.ReturnOrigin)\n else\n theView.GetDisplay.SetExtent(r.Scale(1.1))\n end\n end'end of if not enabled \n end'end of no world file\nend'end of if response\n \n'make list of option s for transform\npicklist={\"1 point (=move)\", \"2 point (=affine)\"}\n'set object tag to result of choice box\n \n self.setobjecttag((msgbox.choiceasstring(picklist.aslist, \"Select transform method: \", \"Coordinate Transform\")))\n \n 'cancel if pick cancel\n if ((self.getobjecttag)= nil)then \n thegui=av.findgui(\"view\")\n thetoolbar=thegui.gettoolbar \n thetoolbar.selectdefault \n exit \n end\n\n \n msgbox.info(\"You will need to pick the pair(s) of points.\"+nl+\"Be sure to pick from the source view FIRST!\"+nl+nl+\"Pick first source drawing pt. now:\",\"Coordinate Transformation\")\n 'end\n'end\n\n\n\n" ) (Script.87 Name: "c_tranu3.ave" SourceCode: "'This is the update script for c_trans.ave.\n'c_transu.ave is the update script.\n'Make the choice available only if the SINGLE active\n'theme is a drawing theme.\n'ABS 7/96\nisdrawing=false\ntheView = av.GetActiveDoc\n if (1 = theView.GetActiveThemes.Count) then \n theDrawing = theView.GetActiveThemes.Get(0).AsString\n theSource=av.getactivedoc.findtheme(theDrawing).getsrcname\n if\n (theSource.asstring.contains(\".dgn\")\n or theSource.asstring.contains(\".dwg\")\n or theSource.asstring.co ntains(\".dxf\"))\n then\n isdrawing=True\n end\n end\nSELF.SetEnabled(isdrawing) \n\n\n\n\n" ) (Script.88 Name: "c_hot3.ave" SourceCode: "'This script is a hot link tool designed to access drawings. You must\n'have a hotlink field set in the theme's properties and this script \n'selected as the hotlink script. A path to use\n'in searching for the drawings may be hardcoded in the script.\n'Field values in the table should have a .dwg extension. \n'Material in this script (shamelessly) stolen from Matt Davis.\n\n\ntheView = av.GetActiveDoc\nfound = false\np = theView.GetDisplay.ReturnUserPoint\nfor each t in theView.GetActiveThemes\n if (t.Is(FTheme)) then 'not image theme\n recs = t.FindByPoint(p)\n for each rec in recs 'for each rec\n theField = t.GetHotField\n if (nil <> theField) then 'non null field\n found = true\n theVal = t.GetFTab.ReturnValueString(theField, rec)\n 'msgbox.info(theval.asstring,\"\")\n if ((theVal.Right(3) = \"dgn\") or (theVal.Right(3) = \"dxf\") or (theVal.Right(3) = \"dwg\"))then 'is drawing\n thebegin=av.g etproject.getfilename.returndir.asstring\n theFilePath =thebegin+\"\\data\\drawings\\\" + theVal\n 'msgbox.info((File.Exists(theFilePath.AsFileName)).asstring,\"\")\n 'SET THE PATH TO YOUR DRAWINGS IN THE ABOVE LINE\n if (Not (theFilePath.IsNull)) then 'file path not null\n if (File.Exists(theFilePath.AsFileName)) then 'file path exists\n srcDWG1 = SrcName.Make(theFilePath + \" polygon\")\n srcDWG2 = SrcName.Make(theFilePath + \" line\")\n srcDWG3 = SrcName.Make(theFilePath + \" point\")\n srcDWG4 = SrcName.Make(theFilePath + \" annotation\")\n t1 = Theme.Make(srcDWG1)\n t2 = Theme.Make(srcDWG2)\n t3 = Theme.Make(srcDWG3)\n t4 = Theme.Make(srcDWG4)\n t1.SetVisible(TRUE)\n t2.SetVisible(TRUE)\n t3.SetVisible(TRUE)\n t4.SetVisible(TRUE)\n t1.SetActive(TRUE)\n t2.SetActive(T RUE)\n t3.SetActive(TRUE)\n t4.SetActive(TRUE)\n \n v = View.Make\n v.AddTheme(t1)\n v.AddTheme(t2)\n v.AddTheme(t3)\n v.AddTheme(t4)\n v.SetTOCWidth(110)\n v.SetName(theFilePath.AsFileName.GetBaseName)\n \n theView = av.getproject.finddoc(theFilePath.AsFileName.GetBaseName.asstring)\n r = theView.ReturnExtent\n\n if (r.IsEmpty) then\n return nil\n elseif ( r.ReturnSize = (0@0) ) then\n theView.GetDisplay.PanTo(r.ReturnOrigin)\n else\n theView.GetDisplay.SetExtent(r.Scale(1.1))\n av.GetProject.SetModified(true)\n end\n\n \n if (av.FindScript(\"View.CloseImageView\") = NIL) then\n s = Script.Make(\"av.GetProject.RemoveDoc(SELF)\")\n s.SetName(\"View.CloseImageView\")\n av.GetProject.AddScript(s)\n end\n \n v.SetCloseScript(\"View.CloseImageView\") \n v.GetWin.Open\n \n end 'file path exists\n end 'file path not null\n else\n MsgBox.Warning(\"File \"+theVal+\" not found or is not a drawing.\",\"Hot Link\")\n exit\n end\n end 'is drawing\n end 'non null field\n end 'end of for each\nend 'not image theme\n\nif (not found) then\n System.Beep\nend\n\n" ) (Script.89 Name: "c_tran3.ave" SourceCode: "'theme.trans\n'theme.transc\n'theme.transu\n'This script theme.trans \n'(theme.tranc is its click script, theme.transu is its update script)\n'performs a one or two point transformation on a cad drawing\n'theme. Two views are expected: the source with the drawing as the active\n'theme and a target view - these may be the same. After selecting which\n'method to use, the user clicks first on the source drawing for its first\n'point, then to the corresponding one on the target view. This is repeated\n'for two point t ransformations. The user is prompted after each point of \n'that points coors. Once the points are assigned, the theme is added to \n'the target view.\n'\n'ABS 6/14/95\n'ABS Updated 4/96 to support DGN, DXF for AV3.0.\n\n'initialize variable\n\n'if (_CADTYPE=nil) then\n\n\n'Set up script to work with whichever type of CAD file you have.\n\ntheView = av.GetActiveDoc\nif (1 = theView.GetActiveThemes.Count) then \ntheDrawing = theView.GetActiveThemes.Get(0).AsString\ntheSource=av.getactivedoc.findtheme(theDrawing).getsrcname \nend\n\n\n'if (theSource.asstring.contains(\".dgn\")) then CADTYPE=\".dgn\" end\n'if (theSource.asstring.contains(\".dwg\")) then CADTYPE=\".dwg\" end\n'if (theSource.asstring.contains(\".dxf\")) then CADTYPE=\".dxf\" end\n\n'end\n\n\n\n'from click script setting of object tag pick correct IF option\n'set globals, and get first point\n\n \nif ((self.getobjecttag)= \"1 point (=move)\") then\n\n _drawpt1=nil\n _tarpt1=nil\n _theDrawView=nil\n _theTarView=nil\n\n _thmDraw = av.GetactiveDoc.GetActiveThemes.Get(0)\n _drawname=_thmdraw.getsrcn ame.getfilename.getfullname\n _theDrawView = av.GetActiveDoc\n _drawpt1=_theDrawView.getdisplay.ReturnUserPoint\n msgbox.info(\"Draw Pt 1: \"++_drawpt1.asstring+nl+\"Now, pick Target Pt 1:\",\"\")\n self.setobjecttag(110)\n exit\nend\n\n'from click script setting of object tag pick correct IF option\n'set globals, and get second point, write world file to where\n'the drawing is and add it to target theme\n\n\nif ((self.getobjecttag) = 110) then\n 'get target point\n _theTarView = av.GetActiveDoc\n _tarpt1=_theTarView.get display.ReturnUserPoint\n\n msgbox.info(\"Target Pt 1: \"++_tarpt1.asstring+nl+\"Now, I will write the world file!\",\"\")\n \n 'get drawing name and make world file with .wld extension\n worldname=_drawname.substitute(_CADTYPE.asstring,\".wld\")\n 'msgbox.info(worldname.asstring,\"name\")\n worldfilename=Filename.make(worldname) \n worldfile=textfile.make(worldfilename,#FILE_PERM_WRITE)\n \n 'create single world file line\n \nline1=_drawpt1.getx.asstring+\",\"+_drawpt1.gety.asstring++_tarpt1.getx.asstring+\",\"+_tarpt1.ge ty.asstring\n line1c=line1.count\n \n 'write line to file\n worldfile.write(line1,line1c)\n worldfile.close\n \n \n ' Create the SourceName\n theSrc=_thmdraw.getsrcname \n\n' Use the SourceName to make a theme...\n aTheme = Theme.Make(theSrc)\n \n' Add the theme to the target view...\n _theTarView.AddTheme(aTheme)\n\n' Set a new name for the theme...\n thmname=_thmdraw.getname\n aTheme.SetName(thmname.asstring)\n\n' Draw the theme...\n aTheme.SetVisible(true)\n\n' Update any other drawings themes to reflect the NEW world file \n theview=av.getactivedoc\n thethemelist=av.getactivedoc.getthemes\n for each x in thethemelist\n \n subname=x.getsrcname.getsubname.asstring\n if (subname <> \"\") then\n\n \n if (x.getftab.isdrawing) then\n w=x.getftab.returnworldfile\n if (w <> nil) then\n x.getftab.setworldfile(w)\n end \n end\n end\n end\n theview.invalidate\n \n' Update the source view's themes to reflect the NEW world file \n theview=_thedrawView\n thethemelist=_thedrawview.getthemes\n for each x in theth emelist\n if (x.getftab.isdrawing) then\n w=x.getftab.returnworldfile\n if (w <> nil) then\n x.getftab.setworldfile(w)\n end \n end\n\n end\n theview.invalidate\n \n \n\n'clear the object tag\n self.setobjecttag(nil)\n exit\nend\n\n'This is same as above; just use two points and write two lines\n'to the world file.\nif ((self.getobjecttag)= \"2 point (=affine)\") then\n\n\n\n\n _drawpt1=nil\n _tarpt1=nil\n _drawpt2=nil\n _tarpt2=nil\n _theDrawView=nil\n _theTarView=nil\n\n _thmDraw = av.GetactiveDoc.Ge tActiveThemes.Get(0)\n _drawname=_thmdraw.getsrcname.getfilename.getfullname\n _theDrawView = av.GetActiveDoc\n _drawpt1=_theDrawView.getdisplay.ReturnUserPoint\n msgbox.info(\"Draw Pt 1: \"++_drawpt1.asstring+nl+\"Now, pick Target Pt 1:\",\"\")\n self.setobjecttag(210)\n exit\nend\n\nif ((self.getobjecttag) = 210) then\n _theTarView = av.GetActiveDoc\n _tarpt1=_theTarView.getdisplay.ReturnUserPoint\n msgbox.info(\"Target Pt 1: \"++_tarpt1.asstring+nl+\"Now, pick Draw Pt 2:\",\"\")\n _theDrawView.getwin.Activate\n self.se tobjecttag(220)\n exit\nend\n\nif ((self.getobjecttag) = 220) then\n\n _drawpt2=_theDrawView.getdisplay.ReturnUserPoint\n msgbox.info(\"Draw Pt 2: \"++_drawpt1.asstring+nl+\"Now, pick Target Pt 2:\",\"\")\n 'msgbox.info(_theTarView.asstring,\"the tar view is:\")\n '_theTarView.getwin.Activate\n self.setobjecttag(221)\n exit\nend\n\nif ((self.getobjecttag) = 221) then\n _tarpt2=_theTarView.getdisplay.ReturnUserPoint\n msgbox.info(\"Target Pt 2: \"++_tarpt1.asstring+nl+\"Now, I will write the world file.\",\"\")\n 'msgbox.info(_C ADTYPE,\"CADTYPE\")\n\n 'msgbox.info(_drawname.asstring,\"DRAW\")\n worldname=_drawname.substitute(_CADTYPE.asstring,\".wld\")\n 'msgbox.info(worldname.asstring,\"name\") \n worldfilename=FN.make(worldname.asstring)\n worldfile=textfile.make(worldfilename,#FILE_PERM_WRITE)\n \n \nline1=_drawpt1.getx.asstring+\",\"+_drawpt1.gety.asstring++_tarpt1.getx.asstring+\",\"+_tarpt1.gety.asstring+nl\n \n'msgbox.info(line1,\"LINE 1\")\n \nline2=_drawpt2.getx.asstring+\",\"+_drawpt2.gety.asstring++_tarpt2.getx.asstring+\",\"+_tarpt2.gety.as string\n\n'msgbox.info(line2,\"LINE 2\")\n\n \n line1c=line1.count\n line2c=line2.count\n \n' msgbox.info(worldfilename.asstring,\"\")\n \n worldfile.write(line1,line1c)\n worldfile.write(line2,line2c)\n \n worldfile.close\n \n \n ' Create the SourceName...\n theSrc=_thmdraw.getsrcname \n\n' Use the SourceName to make a theme...\n aTheme = Theme.Make(theSrc)\n \n' Add the theme to the view...\n _theTarView.AddTheme(aTheme)\n\n' Set a new name for the theme...\n thmname=_thmdraw.getname\n aTheme.SetName(thmname.asstring )\n\n' Draw the theme...\n aTheme.SetVisible(true)\n \n' Update any other drawings themes to reflect the NEW world file \n theview=_thetarview\n thethemelist=_theTarView.getthemes\n for each x in thethemelist\n subname=x.getsrcname.getsubname.asstring\n if (subname <> \"\") then\n if (x.getftab.isdrawing) then\n w=x.getftab.returnworldfile\n if (w <> nil) then\n x.getftab.setworldfile(w)\n end \n end\n end\n \n end\n theview.invalidate\n \n\n' Update the source view's t hemes to reflect the NEW world file \n theview=_thedrawView\n thethemelist=_thedrawview.getthemes\n 'msgbox.list(thethemelist,\"\",\"\")\n for each x in thethemelist\n x.getftab.setworldfileenable(true)\n w=x.getftab.returnworldfile\n ' msgbox.info(w.asstring,\"worldfile\")\n if (x.getftab.isdrawing) then\n if (w <> nil) then\n x.getftab.setworldfile(w)\n end \n end\n end\n theview.invalidate\n\n \n\n self.setobjecttag(nil)\n exit\nend \n \n\n\n\n\n" ) (Script.90 Name: "c_lay3M.ave" SourceCode: "'-- Separates features and creates new themes based\n'-- on the values in the layer field\n'-- Use with the update script \"Separate Layers Update\"\n\n'Original code by Rich Laird, ESRI-Boston\n'Updated to run with AV3.0 and DGN files by Adena Schutzberg, ESRI-Boston\n'4/96\n'Updated to ask if you want to nuke source themes. 7/96\n'Updated to use NOT a theme definition query, but a \"CAD layer on\" type query.\n'This, per Matt Davis' suggestion is much faster. 9/1/96\n\nthereply=msgbox.yesno\n(\"Remove the origin al themes from the view?\"+nl+\"This will only change the view not the data!\",\"Question...\",TRUE)\n\n\ntheView = av.GetActiveDoc\ntheThemes = theView.GetActiveThemes\n\n'-- for each of the active themes ....\nfor each thm in theThemes\n '-- if the theme is an image theme, skip it\n if (thm.Is( FTHEME ).Not) then\n Continue\n end\n \n '-- if the theme is not a drawing theme, skip it\n if (thm.GetFTab.IsDrawing.Not) then\n Continue\n end\n \n cadLegend = thm.GetLegend\n cadLegendField = cadLegend.GetField Names\n\n '-- see if the theme has been symolized on some other field than\n '-- the default \"color\" field\n if (cadLegendField.GetName <> \"Color\") then\n thmSrc = thm.GetSrcName\n tempTheme = Theme.Make(thmSrc)\n tempLegend = tempTheme.GetLegend\n tempTheme = nil\n theClassifications = tempLegend.GetClassifications\n theSymbols = tempLegend.GetSymbols\n else\n theClassifications = cadLegend.GetClassifications\n theSymbols = cadLegend.GetSymbols\n end\n\n lookUpDictionary = Dictionary.Ma ke(10)\n for each c in 0..(theClassifications.Count - 1)\n lookUpDictionary.Add(theClassifications.Get(c).GetLabel, theSymbols.Get(c))\n end\n\n theFTab = thm.GetFTab\n layerFld = theFTab.FindField(\"Layer\")\n if (layerFld = nil) then\n MsgBox.Error(\"Layer field not found\",\"Feature Table Error\")\n exit\n end\n \n '-- get a list of the unique layer names\n layerList = List.Make\n for each rec in theFTab\n 'msgbox.info(rec.asstring,\"rec\")\n layerName = theFTab.ReturnValue(layerFld, rec)\n 'msgb ox.info(layername.asstring,\"layername\")\n inList = layerList.FindByValue(layerName)\n 'msgbox.listasstring(inList,\"\",\"\")\n if (inList = -1) then\n '-- build an index on the Layer field to improve the query speed\n isIndexed = theFTab.IsFieldIndexed(layerFld)\n if (isIndexed.Not) then\n theFTab.CreateIndex(layerFld)\n end\n \n '-- make a clone of the theme and set the definiton to the queryStmt\n clonedTheme = thm.Clone\n clonedFTab = clonedTheme.GetFTab\n 'queryStmt = \"( [Layer] = \"\"\" + layerName + \"\"\")\"\n 'clonedFTab.SetDefinition(queryStmt)\n \n deflist=list.make\n deflist.add(layerName)\n 'msgbox.listasstring(deflist,\"\",\"\")\n clonedFTab.SetSelectedLayers (deflist)\n\n \n clonedTheme.SetName(layerName)\n clonedTheme.SetActive(FALSE)\n \n clonedLegend =clonedTheme.GetLegend\n clonedLegend.Unique(clonedTheme, clonedFTab.FindField(\"Color\").asstring)\n clonedClassifications = clonedLegend.GetClassifications\n clonedSymbols = clonedLegend.GetSymbols\n for each ns in 0..(clonedSymbols.Count - 1)\n theSymbol = clonedSymbols.Get(ns)\n cadSymbol = lookUpDictionary.Get(clonedClassifications.Get(ns).GetLabel)\n theSymbol.SetColor(cadSymbol.GetColor)\n if ((theSymbol.GetType = #SYMBOL_FILL).Not) then\n theSymbol.SetSize(cadSymbol.GetSize)\n end\n end\n \n '-- add the cloned theme to the View\n theView.AddTheme(clonedTheme)\n layerList.Add(layerName)\n end\n end\n end\n \nif (thereply) then\n for each x in theThemes\n '-- if the theme is an image theme, skip it\n if (x.Is( FTHEME ).Not) then \n Continue \n end\n '-- if the theme is not a drawing theme, skip it\n if (x.GetFTab.IsDrawing.Not) then\n Continue\n end\n theview.deletetheme(x)\n end 'for each\nend 'if\n\n\n\n\n" ) (Script.91 Name: "c_tx2p3.ave" SourceCode: "'This script converts the selected text from the active theme into\n'point shapes with the text as attributes. This is designed\n'to work with CAD text, though anywill do and creates an item called CADText in\n'its FAT. If no text is found an error message is returned.\n\n'Updated to AV3 for DGN 8/22/96. ABS\n'Updated to let user determine where to put new theme, per Bill S.\n\n'First make sure the active theme is an annotation theme\ntheView = av.GetActiveDoc\ntheTextTheme=av.getactivedoc.getactivethemes.get(0)\nif (theTextTheme.getsrcname.getsubname <> \"annotation\") then\nmsgbox.warning(\"Sorry, the active theme is not an annotation theme! Try again!\",\"\")\nexit\nend\n\n'Get the number of selected text guys\ntheTextTable=theTextTheme.GetFtab\ntheOrigBitmap=theTextTheme.GetFtab.GetLastSelection\n'msgbox.info(theTextTable.GetSelection.Count.asstring,\"Number selected\")\n\n'Check if there is a selection set\nif (theTextTable.GetSelection.Count = 0) then doall=true else doall=false end\n\n'if there is grab all of the text in the theme \nif (doall) then\n theTextTable.query(\"([Entity]=\"\"Text\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no text features in the theme!\",\"\")\n exit\n end\n'if there is a selected set find all the text in it\nelse\n theTextTable.query(\"([Entity]=\"\"Text\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_AND)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no text features in selected set!\",\"\")\n exit\n end\nend\n\n'Find and report the total number of text entities to be converted\ntheNumRec=theTextTable.GetSelection.Count\ntheanswer=msgbox.yesno(theNumRec.asstring++\"text elements to be converted!\"+nl+\"(Some may have been block attributes!)\"+nl+\"Label new point theme and turn of annotation?\", \"\",true)\n\n'if (theanswer) then msgbox.info(\"yes\",\"\") else (msgbox.info(\"no\",\"\")) end\n\n'Make a new shape theme\ntype =\"Point\"\nclass = Point\n'Make sure to get a new name for it\n\n'This is where we write all the extra needed f iles:\nthemepath=thetexttheme.getsrcname.getfilename.returndir\n\n'Get a new file name, but make a suggestions of thetexttheme.shp\nnewfilename=themepath.maketmp(theTextTheme.asstring,\"shp\")\nshapethemename=FileDialog.Put (newfilename, \"shp\", \"Save\")\n \n \nif (shapethemename = nil ) then \n exit \nend\n'msgbox.info(newfilename.asstring,\"\")\n\n\n\n'def=av.getproject.getworkdir.maketmp(theTextTheme.asstring,\"shp\")\ndef=shapethemename\nif (def <> nil) then\n tbl = FTab.MakeNew(def, class)\n 'fld = Field.Make(\"ID\", #FIELD_DECIMAL, 8, 0)\n 'fld.SetVisible( FALSE )\n 'tbl.AddFields({fld})\n theTheme = FTheme.Make(tbl)\n theView.AddTheme(theTheme)\n theTheme.SetActive(TRUE)\n theTheme.SetVisible(TRUE)\n theView.SetEditableTheme(theTheme)\n av.GetProject.SetModified(true)\nend\n\n'Add the TEXT field to the new theme\ntheme1table=av.getactivedoc.findtheme(def.getbasename).getftab\nthenewfield=field.make(\"CADText\", #FIELD_CHAR, 25, 0)\ntheme1table.addfields({thenewfield})\n\n\n\n'Walk through each record and pull out the text value a nd\n'the shape. Stuff each into the new theme.\nfor each n in theTextTable.GetSelection\n 'msgbox.info(n.asstring,\"N\")\n theTextValue=theTextTable.returnvalue(theTextTable.findfield(\"Text\"),n)\n theShapeValue=theTextTable.returnvalue(theTextTable.findfield(\"Shape\"),n)\n theShapeCoors=theShapeValue.ReturnCenter\n thePointTable=av.getactivedoc.findtheme(DEF.getbasename).getftab\n theNewPoint=point.make(theShapeCoors.getx,theshapecoors.gety)\n theRecordNum=thePointTable.addrecord\n thePointTable.setvalue(thepoi ntTable.findfield(\"CADTEXT\"),theRecordNum,theTextvalue)\n thePointTable.setvalue(thepointTable.findfield(\"Shape\"),theRecordNum, theNewPoint)\nend\n\nif (theanswer) then\n 'thetheme\n theview=av.getactivedoc\n thetexttheme.setactive(false)\n thetheme.setlabelfield(thetheme.getftab.findfield(\"CADtext\"))\n theview.labelthemes(false)\n thetexttheme.setvisible(false)\n 'thetexttheme.getgraphics.delete\n \nend\n\n \n\n \n'Turn the pointtable editing off and update the bitmap to the one we started with \nthepointtable.se teditable(false)\ntheTheme.setactive(false)\nthetexttheme.setactive(true)\ntheTextTable.Setselection(TheOrigBitmap.clone)\ntheTextTable.UpdateSelection\n\n" ) (Script.92 Name: "c_txinp3.ave" SourceCode: "'This script asks for a text theme and a DWG polygon theme. It\n'add the text value of the text theme to the polygon that\n'bounds it. \n\n'Updated to restrict picking only appropraite theme types. ABS 9/1/96\n'Updated to provide option of naming the new table. ABS 9/9/96\n'Updated to remove reference to table in project. ABS 9/9/96\n\n'Get the two themes needed - these should have ONLY the entities\n'of interest!\n\n'get only anno themes, please\nmylist=list.make\nthethemelist=av.getactivedoc.getthemes\nfor each x i n thethemelist\n 'if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Annotation\") then \n 'if (((x.getsrcname.getname.contains(\"dxf\")).not)\n 'and ((x.getsrcname.getname.contains(\"dwg\")).not)) then\n (mylist.add(x))\n 'end\n end\n 'end\nend\n\nif (mylist = nil) then msgbox.info(\"Sorry no text themes in view.\") exit end\n\ntxttheme=msgbox.choice(mylist, \"Pick text theme:\", \"Text theme:\")\nif (txttheme = nil) then exit end\n\n'Check to see if there is a selection set\ntheTextTable=txttheme.getftab\nif (theTextTable.GetSelection.Count = 0) then doalltext=true else doalltext=false end\n\n'Get the bitmap so we can reset it later\ntheOrigTextBitmap=TxtTheme.GetFtab.GetLastSelection\n\n'If there is no selected set grab all the text in the theme\nif (doalltext) then\n theTextTable.query(\"([Entity]=\"\"Text\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no text features in the theme!\",\"\")\n exit\n e nd\n'If there is a selected set, find all the text in the selected set\nelse\n theTextTable.query(\"([Entity]=\"\"Text\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_AND)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no text features in selected set!\",\"\")\n exit\n end\nend\n\n'get only poly dwg\\dxf themes, please\nmylist=list.make\nthethemelist=av.getactivedoc.getthemes\nfor each x in thethemelist\n if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Polygon\") then \n if (((x.getsrcname.getname.contains(\"dxf\")))\n or ((x.getsrcname.getname.contains(\"dwg\")))) then\n (mylist.add(x))\n end\n end\n end\nend\n\nif (mylist = nil) then msgbox.info (\"Sorry, no valid CAD polygon themes in view\",nil) exit end\n\npolytheme=msgbox.choice(mylist, \"Pick polygon theme:\", \"Polygon theme:\")\nif (txttheme = nil) then exit end\n\n\n'Find out if there is a selected set\nthePolyTable=polytheme.getftab\nif (thePolyTable.GetSelection.Count = 0) then doallpoly=true els e doallpoly=false end\n\n'Get the bitmap so we can reset it later\ntheOrigPolyBitmap=PolyTheme.GetFtab.GetLastSelection\n\n'if there is no selected set grab all the polygons\nif (doallpoly) then\n thePolyTable.query(\"([Entity]<>\"\"\"\")\",thePolyTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (thePolyTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no polygon features in the theme!\",\"\")\n exit\n end\n'if there is a selected set get all the polygons in it\nelse\n thePolyTable.query(\"([Entity]<>\"\"\"\")\",the PolyTable.GetSelection,#VTAB_SELTYPE_AND)\n if (thePolyTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no polygon features in selected set!\",\"\")\n exit\n end\nend\n\n\n'Get their tables\ntxtftab=txttheme.getftab\npolyftab=polytheme.Getftab\n\n'Make a dictionary to put the shape and text in\ntextdict=dictionary.make(200)\n\n'Get the fields in the text table we'll need\ntshp=txtftab.findfield(\"shape\")\nttext=txtftab.findfield(\"text\")\n\n'make a table to hold the results - the text value and\n'the handle of the poly the text is in\n\n'This is where we write all the extra needed files:\npolythemepath=polytheme.getsrcname.getfilename.returndir\n\n'Make the new table for the text - by default named textxx.dbf\n'x=polythemepath.maketmp(\"text\",\"dfb\")\n\n'If you want to name the table yourself uncomment the following \n'2 lines and comment the one above.\nnewfilename=polythemepath.maketmp(\"text\",\"dbf\")\nx=FileDialog.Put (newfilename, \"dbf\", \"Save new table as\")\nif (x=nil) then exit end\n\n\nthetable=table.make(vtab.makenew(x, dbase))\nav.getproject.adddoc(thetable)\nthehandlefield=field.make(\"Handle\",#FIELD_CHAR, 10,0)\nthetextfield=field.make(\"CADText\", #FIELD_CHAR, 20, 0)\nthetable.getvtab.addfields({thehandlefield,thetextfield})\nthetablevtab=thetable.getvtab\n\n'Set the fields where the results will go\nptext=thetablevtab.findfield(\"CADText\")\nphandle=thetablevtab.findfield(\"Handle\")\n\n'Fill the dictionary with shapes and text\nfor each rec in txtftab.getselection\n shp=txtftab.returnvalue(tshp,rec)\n text=txtftab.returnvalue(ttext,rec)\n textdict.add(shp,text)\nend\n\n'Get the polygon's shape field\npshp=polyftab.findfield(\"shape\")\n\n'Walk throught the polys and get the shape and handle and closest text\nfor each rec in polyftab.getselection\n polyshp=polyftab.returnvalue(pshp,rec)\n handle=polyftab.returnvalue(polyftab.findfield(\"handle\"),rec)\n \n dist=9999999\n for each sh in textdict.returnkeys\n newdist=polyshp.distance(sh)\n if (newdist < dist) then\n polytext=textdict.get(sh)\n dist=newdist\n if (dist=0) then break end\n end\n end\n 'Add the found stuff to the new table\n if (dist = 0) then\n theRecNum=thetablevtab.addrecord\n thetablevtab.setValue(ptext,theRecNum,polytext)\n thetablevtab.setValue(phandle,theRecNum,handle)\n else\n theRecNum=thetablevtab.addrecord\n thetablevtab.setValue(ptext,theRecNum,\"No text!\")\n thetablevtab.setValue(phandle,theRecNum,\"No handle!\")\n\n end\nend\n\n'Join the new table back to the polygon table!\npolyftab.findfield(\"Handle\").setvisible(true)\npolyftab.join(polyftab.fi ndfield(\"Handle\"),thetablevtab,thetablevtab.findfield(\"Handle\"))\n\n'Reset the bitmaps to what they were at the outset\ntheTextTable.SetSelection(theOrigTextBitmap.clone)\ntheTextTable.UpdateSelection\nthePolyTable.SetSelection(theOrigPolyBitmap.clone)\nthePolyTable.UpdateSelection\n\n'Remove reference to table from project\nav.getproject.removedoc(thetable)\n\n\n" ) (Script.93 Name: "c_blinp3.ave" SourceCode: "'This script asks for a block theme and a polygon theme. It\n'add the attribute values of the block theme to the polygon that\n'bounds it. \n\n'Updated to get around known bug in AV3 Beta 3.0 involving joining\n'tables with same name. ABS 5/18/96 UC\n\n'Updated to present only valid choices for themes. Also, uses location of\n'CAD theme as location for new themes. ABS 9/1/96\n\n'Updated to provide option of naming new file and remove ref to new table.\n'ABS 9/9/96\n\n'Updated to allow non-CAD point features, like s hapes, to be captured,too.\n\n\n'Get the two themes needed - these should have ONLY the entities\n'of interest!\n\n'get only DWG block themes, please\nmylist=list.make\nthethemelist=av.getactivedoc.getthemes\nfor each x in thethemelist\n 'if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Point\") then \n 'if (((x.getsrcname.getname.contains(\"dxf\")))\n ' or ((x.getsrcname.getname.contains(\"dwg\")))) then\n (mylist.add(x))\n 'end\n end\n 'end\nend\n\ntxttheme=msgbox.cho ice(mylist, \"Pick point theme:\", \"Point theme:\")\nif (txttheme = nil) then exit end\n\n'if (txttheme.getsrcname.getname.contains(shp)) then\n\n ' thetextitem=msgbox.choice(txttheme.getftab.getfields,\"Which item contains the text \"+ \n ' \"you would like linked to the polygons?\",\"Item selection...\")\n ' if (thetextitem = nil) then exit end\n\n'end\n\n\n'Get the Bitmap so we can replace it later so the screen looks the same\n'when you finish as when you start\ntheTextTable=txttheme.getftab\ntheTextOrigBitmap=theTextTable.Get LastSelection\n\n'Figure if there is a selected set\nif (theTextTable.GetSelection.Count = 0) then doalltext=true else doalltext=false end\n\n'If there's no selected set find all the blocks in the theme, other\n'wise find all the blocks in the selected set\nif (doalltext) then\n theTextTable.query(\"([Shape] <> \"\"Point\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no point features in the theme!1\",\"\")\n exit\n end\nelse\n theTextTa ble.query(\"([Shape]<>\"\"Point\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_AND)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no point features in selected set!2\",\"\")\n exit\n end\nend\n\n'get only poly themes, please\nmylist=list.make\nthethemelist=av.getactivedoc.getthemes\nfor each x in thethemelist\n if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Polygon\") then \n if (((x.getsrcname.getname.contains(\"dxf\")))\n or ((x.getsrcname.getname.con tains(\"dwg\")))) then\n (mylist.add(x))\n end\n end\n end\nend\n\npolytheme=msgbox.choice(mylist, \"Pick polygon theme:\", \"Polygon theme:\")\nif (polytheme = nil) then exit end\n\n\n'Get its bitmap for later\nthePolyOrigBitmap=PolyTheme.GetFtab.GetLastSelection\n\n'Check if there's a selected set\nthePolyTable=polytheme.getftab\nif (thePolyTable.GetSelection.Count = 0) then doallpoly=true else doallpoly=false end\n\n'If there is no selected set grab all the polygons,\n'if there is a selected set get onl y the selcted set\nif (doallpoly) then\n thePolyTable.query(\"([Entity]<>\"\"\"\")\",thePolyTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (thePolyTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no polygon features in the theme!\",\"\")\n exit\n end\nelse\n thePolyTable.query(\"([Entity]<>\"\"\"\")\",thePolyTable.GetSelection,#VTAB_SELTYPE_AND)\n if (thePolyTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no polygon features in selected set!\",\"\")\n exit\n end\nend\n\n'Get the two theme's tables\ntxtftab=txttheme.getftab\npolyftab=polytheme.Getftab\n\n'Make a dictionary to put the shape and block attributes in\ntextdict=dictionary.make(200)\n\n'Get the attributes by eliminating all the standard CAD fields\nthefieldlist=txtftab.getfields\ntheignorelist={\"Shape\",\"Entity\",\"Layer\",\"Color\",\"Elevation\",\"Thickness\",\"Linetype\",\"Linewidth\",\"Text\",\"Style\"}\nthekeeplist={}\nfor each x in thefieldlist\n there=theignorelist.findbyvalue(x.asstring)\n if (there = -1) then thekeeplist.add(x) end\nend\nthecount=thekeepli st.count\n\n'Get the fields in the block table we'll need\ntshp=txtftab.findfield(\"shape\")\n\n'This is where we write all the extra needed files:\npolythemepath=polytheme.getsrcname.getfilename.returndir\n\n\n'make a table to hold the results - the handle of the poly \n'the block is in and a field for each attribute;default name in blockxx.dbf\n't=polythemepath.maketmp(\"block\",\"dfb\")\n\n'If you want to name the table yourself uncomment the following \n'2 lines and comment the one above.\nnewfilename=polythemepath.maketmp( \"block\",\"dbf\")\nt=FileDialog.Put (newfilename, \"dbf\", \"Save new table as\")\n\nif (t=nil) then exit end\n\n\n\nthetable=table.make(vtab.makenew(t,dbase))\nav.getproject.adddoc(thetable)\nthetablevtab=thetable.getvtab\nfor each x in thekeeplist\n x=field.make(x.asstring,x.gettype, x.getwidth,x.getprecision)\n thetable.getvtab.addfields({x})\nend\n\n'Set the fields where the results will go\nphandle=thetablevtab.findfield(\"Handle\")\nif (phandle = nil) then \n x=field.make(\"Handle\",#FIELD_CHAR ,8,0)\n thetable.getvtab.addfiel ds({x})\n phandle=thetablevtab.findfield(\"Handle\")\n\nend\n'\n'Fill the dictionary with shapes and a list made up of the\n'attribute values\nfor each rec in txtftab.getselection\n shp=txtftab.returnvalue(tshp,rec)\n attlist={}\n for each x in thekeeplist\n v=txtftab.returnvalue(x,rec)\n 'msgbox.info(v.asstring,\"V\")\n attlist.insert(v)\n end \n textdict.add(shp,attlist)\nend\n\n'Get the polygon's shape field\npshp=polyftab.findfield(\"shape\")\n\n'Walk through the polys and get the shape and handle of the closest block\nfor each rec in polyftab.getselection\n polyshp=polyftab.returnvalue(pshp,rec)\n handle=polyftab.returnvalue(polyftab.findfield(\"handle\"),rec)\n \n dist=9999999\n for each sh in textdict.returnkeys\n newdist=polyshp.distance(sh)\n if (newdist < dist) then\n polytext=textdict.get(sh)\n dist=newdist\n if (dist=0) then break end\n end\n end\n 'Add the found stuff to the new table\n if (dist = 0) then\n theRecNum=thetablevtab.addrecord\n for each x in thekeeplist\n thetabl evtab.setValue(thetablevtab.findfield(x.asstring),theRecNum,polytext.get((thecount-(thekeeplist.findbyvalue(x)+1))))\n end\n 'msgbox.info(phandle.asstring,\"\")\n thetablevtab.setValue(phandle,theRecNum,handle)\n \n end\nend\n\n\n'Join the new table back to the polygon table!\npolyftab.findfield(\"Handle\").setvisible(true)\npolyftab.join(polyftab.findfield(\"Handle\"),thetablevtab,thetablevtab.findfield(\"Handle\"))\n\n\n'Reset the bitmaps to what they were before\ntheTextTable.SetSelection(theTextOrigBitmap. clone)\ntheTextTable.UpdateSelection\nthePolyTable.SetSelection(thePolyOrigBitmap.clone)\nthePolyTable.UpdateSelection\n\n'Remove reference to table in project\nav.getproject.removedoc(thetable)\n\n\n" ) (Script.94 Name: "c_txind3.ave" SourceCode: "'This script asks for a text theme and a DGN polygon theme. It\n'add the text value of the text theme to the polygon that\n'bounds it. \n\n'Updated 9\\10\\96 ABS to allow user to name new table. See below where\n'to comment out. Also, fixed cleanup routine.\n\n'Get the two themes needed - these should have ONLY the entities\n'of interest!\n\n\n'get only anno themes, please\nmylist=list.make\nthethemelist=av.getactivedoc.getthemes\nfor each x in thethemelist\n 'if (x.getftab.isdrawing) then \n if (x.getsrcname.getsub name = \"Annotation\") then \n 'if (((x.getsrcname.getname.contains(\"dxf\")).not)\n 'and ((x.getsrcname.getname.contains(\"dwg\")).not)) then\n (mylist.add(x))\n 'end\n end\n 'end\nend\n\ntxttheme=msgbox.choice(mylist, \"Pick text theme:\", \"Text theme:\")\nif (txttheme = nil) then exit end\n\n\n'Check to see if there is a selection set\ntheTextTable=txttheme.getftab\nif (theTextTable.GetSelection.Count = 0) then doalltext=true else doalltext=false end\n\n'Get the bitmap so we can reset i t later\ntheOrigTextBitmap=TxtTheme.GetFtab.GetLastSelection\n\n'If there is no selected set grab all the text in the theme\nif (doalltext) then\n theTextTable.query(\"([Entity]=\"\"Text\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no text features in the theme!\",\"\")\n exit\n end\n'If there is a selected set, find all the text in the selected set\nelse\n theTextTable.query(\"([Entity]=\"\"Text\"\")\",theTextTable.GetSelection,#VTAB_SELT YPE_AND)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no text features in selected set!\",\"\")\n exit\n end\nend\n\n'Get the polygon theme\n\n'get only polygon dgn themes, please\nmylist=list.make\nthethemelist=av.getactivedoc.getthemes\nfor each x in thethemelist\n if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Polygon\") then \n if (((x.getsrcname.getname.contains(\"dxf\")).not)\n and ((x.getsrcname.getname.contains(\"dwg\")).not)) then\n (mylist.add(x))\n end\n end\n end\nend\n\npolytheme=msgbox.choice(mylist, \"Pick polygon DGN theme:\", \"Polygon theme:\")\nif (polytheme = nil) then exit end\n\n\n'Find out if there is a selected set\nthePolyTable=polytheme.getftab\nif (thePolyTable.GetSelection.Count = 0) then doallpoly=true else doallpoly=false end\n\n'Get the bitmap so we can reset it later\ntheOrigPolyBitmap=PolyTheme.GetFtab.GetLastSelection\n\n'if there is no selected set grab all the polygons\nif (doallpoly) then\n thePolyTable.query(\"([ Entity]<>\"\"\"\")\",thePolyTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (thePolyTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no polygon features in the theme!\",\"\")\n exit\n end\n'if there is a selected set get all the polygons in it\nelse\n thePolyTable.query(\"([Entity]<>\"\"\"\")\",thePolyTable.GetSelection,#VTAB_SELTYPE_AND)\n if (thePolyTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no polygon features in selected set!\",\"\")\n exit\n end\nend\n\n'This is where we write all the extra needed files:\npolythemepath=polytheme.getsrcname.getfilename.returndir\n\n\nthepolytable.export((polythemepath.asstring+\"\\shape.shp\").asfilename, shape, true)\n\npshape=theme.make(srcname.make(polythemepath.asstring+\"\\shape.shp\"))\nptable=pshape.getftab\nptable.seteditable(true)\nthehandlefield=field.make(\"Handle\",#FIELD_CHAR, 10,0)\nptable.addfields({thehandlefield})\n\n\nfor each record in ptable\n ptable.SetValueString(ptable.findfield(\"handle\"), record, record.asstring)\n end\n\nptable.seteditable(false)\n \n\n\n'Get their tables\ntxtftab=txttheme.getftab\ntxtftab.query(\"([Entity]<>\"\"\"\")\",txtftab.GetSelection,#VTAB_SELTYPE_NEW)\n\npolyftab=ptable\npolyftab.query(\"([Entity]<>\"\"\"\")\",polyftab.GetSelection,#VTAB_SELTYPE_NEW)\n\n'Make a dictionary to put the shape and text in\ntextdict=dictionary.make(200)\n\n'Get the fields in the text table we'll need\ntshp=txtftab.findfield(\"shape\")\nttext=txtftab.findfield(\"text\")\n\n'Fill the dictionary with shapes and text\nfor each rec in txtftab.getselection\n shp=txtftab.returnvalue(tshp,re c)\n text=txtftab.returnvalue(ttext,rec)\n textdict.add(shp,text)\nend\n\n\n\n'make a table to hold the results - the text value and\n'the handle of the poly the text is in\n\nx=(polythemepath.asstring+\"\\results\").asfilename\n\nthetable=table.make(vtab.makenew(x,dbase))\nav.getproject.adddoc(thetable)\nthetable.setname(\"results\")\nthehandlefield=field.make(\"Handle\",#FIELD_CHAR, 10,0)\nthetextfield=field.make(\"DGNText\", #FIELD_CHAR, 10, 0)\nthetable.getvtab.addfields({thehandlefield,thetextfield})\nthetablevtab=thetable.getvt ab\n\n\n'Set the fields where the results will go\nptext=thetablevtab.findfield(\"DGNText\")\nphandle=thetablevtab.findfield(\"Handle\")\n\n\n'Get the polygon's shape field\npshp=polyftab.findfield(\"shape\")\n\n'Walk throught the polys and get the shape and handle and closest text\nfor each rec in polyftab.getselection\n polyshp=polyftab.returnvalue(pshp,rec)\n handle=polyftab.returnvalue(polyftab.findfield(\"handle\"),rec)\n \n dist=9999999\n for each sh in textdict.returnkeys\n newdist=polyshp.distance(sh)\n if (newdist < dist) then\n polytext=textdict.get(sh)\n dist=newdist\n if (dist=0) then break end\n end\n end\n 'Add the found stuff to the new table\n \n if (dist = 0) then\n theRecNum=thetablevtab.addrecord\n thetablevtab.setValue(ptext,theRecNum,polytext)\n thetablevtab.setValue(phandle,theRecNum,handle)\n else\n theRecNum=thetablevtab.addrecord\n thetablevtab.setValue(ptext,theRecNum,\"No text!\")\n thetablevtab.setValue(phandle,theRecNum,\"No handle!\")\n\n end\nend\nthetablevtab.s eteditable(false)\n\n'Join the new table back to the polygon table!\npolyftab.findfield(\"Handle\").setvisible(true)\n\npolyftab.join(polyftab.findfield(\"Handle\"),thetablevtab,thetablevtab.findfield(\"Handle\"))\npolyftab.refresh\n\n'write out the joined files to a new shape file so the new items are \n'spatailly joinable\n\n'Make the new table for the text - by default named textxx.dbf\n'dgnshp=polythemepath.maketmp(\"dgnshp\",\"dfb\")\n\n'If you want to name the table yourself uncomment the following \n'2 lines and comment the one above.\nnewfilename=polythemepath.maketmp(\"dgnshp\",\"dbf\")\ndgnshp=FileDialog.Put (newfilename, \"dbf\", \"Save new table as\")\n\nif (dgnshp = nil) then exit end\n\n\n\n\n'dgnshp=polythemepath.MakeTmp (\"dgnshp\",\"dbf\")\n'msgbox.info(dgnshp.asstring,\"dgnshp\")\n\npolyftab.export(dgnshp, shape, true)\n'msgbox.info((polythemepath.asstring+\"\\\"+dgnshp.getbasename.left(dgnshp.getbasename.count-3)+\"shp\").asstring,\"real shape\")\nthesrcname=srcname.make(polythemepath.asstring+\"\\\"+dgnshp.getbasename.left(dgnshp.getbasename.count-3)+ \"shp\")\n\npshape2=theme.make(thesrcname)\n'msgbox.list(pshape2.getftab.getfields,\"\",\"\")\n\nallfields=pshape2.getftab.getfields\nthebadfields={}\nfor each fieldname in allfields\n'msgbox.info(fieldname.asstring,\"field\")\nif (fieldname.asstring <> \"Shape\") then\nif (fieldname.asstring <> \"DGNText\") then\nthebadfields.add(fieldname)\nend\nend\nend\n\n'msgbox.list(thebadfields,\"\",\"\")\n\n'thebadfields=pshape2.getftab.\npshape2.getftab.seteditable(true)\npshape2.getftab.removefields(thebadfields)\npshape2.getftab.seteditable(false)\n\n 'Now do the spatial join back to the DGN file\n\npolytheme.getftab.join(polytheme.getftab.findfield(\"Shape\"),pshape2.getftab,pshape2.getftab.findfield(\"Shape\"))\n\n\n'Reset the bitmaps to what they were at the outset\ntheTextTable.SetSelection(theOrigTextBitmap.clone)\ntheTextTable.UpdateSelection\nthePolyTable.SetSelection(theOrigPolyBitmap.clone)\nthePolyTable.UpdateSelection\n\n\n'Now clean up!!\n\n'nuke results table\n\npolyftab.unjoinall\n\nresults=av.getproject.finddoc(\"results\")\nresults.getvtab.unjoinall\nav.getproject .removedoc(results)\nthevtab=results.getvtab\nresults.getvtab.deactivate\nthevtab=nil\nresults=nil\nav.purgeobjects\nfile.delete((polythemepath.asstring+\"\\results.dbf\").asfilename)\n\n\npshape=theme.make(srcname.make(polythemepath.asstring+\"\\shape.shp\"))\nptable=pshape.getftab\nptable.unjoinall\nav.purgeobjects\n\n'nuke parts of the final shape file we don't need (shp, shx)\nptable.deactivate\nav.purgeobjects\nav.getactivedoc.deletetheme(pshape)\nfor each base in {\"\\\"+dgnshp.getbasename.left(dgnshp.getbasename.asstring.count -3),\"\\shape.\"}\nfor each ext in {\"shp\",\"shx\"}\n file.delete((polythemepath.asstring+base+ext).asfilename)\nend\nend\nav.purgeobjects\n\n'Finally, get rid of the shape.dbf. Note that the only file left is\n'dgnshpxx.dbf which was spatially joined back to the DGN.\n'Ah, the power of a spatial join!\npolyftab.unjoinall\npolyftab.deactivate\npolyftab=nil\nav.purgeobjects\n\nfile.delete((polythemepath.asstring+\"\\shape.dbf\").asfilename)\n" ) (Script.95 Name: "c_ptind3.ave" SourceCode: "'This script asks for a POINT theme and a DGN polygon theme. It\n'add an item value of the Point theme to the polygon that\n'bounds it. \n\n'Updated 9/1/96 to restrict theme choices. ABS\n'Updated 9/9/96 to allow choice of name of new file and fix cleanup. \n\n'This routine will create 1 (one) file on your harddrive by default\n'called dgnshpxx.dbf in the same directory as the source drawing for the\n'theme in question. You may alternatively comment code to allow the user\n'to name this new file. See below.\n\n'Get the two themes needed - these should have ONLY the entities\n'of interest!\n\n\n'get only POINT themes, please\nmylist=list.make\nthethemelist=av.getactivedoc.getthemes\nfor each x in thethemelist\n 'if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Point\") then \n 'if (((x.getsrcname.getname.contains(\"dxf\")).not)\n 'and ((x.getsrcname.getname.contains(\"dwg\")).not)) then\n (mylist.add(x))\n 'end\n end\n 'end\nend\n\ntxttheme=msgbox.choice(mylist, \"Pick point the me:\", \"Point theme:\")\nif (txttheme = nil) then exit end\n\nthetextitem=msgbox.choice(txttheme.getftab.getfields,\"Which item contains the text \"+ \n\"you would like linked to the polygons?\",\"Item selection...\")\nif (thetextitem = nil) then exit end\n\n'Check to see if there is a selection set\ntheTextTable=txttheme.getftab\nif (theTextTable.GetSelection.Count = 0) then doalltext=true else doalltext=false end\n\n'Get the bitmap so we can reset it later\ntheOrigTextBitmap=TxtTheme.GetFtab.GetLastSelection\n\n'If there is no selected set grab all the text in the theme\nif (doalltext) then\n theTextTable.query(\"([Shape]<>\"\"Point\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no point features in the theme!\",\"\")\n exit\n end\n'If there is a selected set, find all the text in the selected set\nelse\n theTextTable.query(\"([Shape]=\"\"Point\"\")\",theTextTable.GetSelection,#VTAB_SELTYPE_AND)\n if (theTextTable.GetSelection.Count = 0) then\n msgbox.in fo (\"Sorry, no point features in selected set!\",\"\")\n exit\n end\nend\n\n'Get the polygon theme\n\n'get only polygon dgn themes, please\nmylist=list.make\nthethemelist=av.getactivedoc.getthemes\nfor each x in thethemelist\n if (x.getftab.isdrawing) then \n if (x.getsrcname.getsubname = \"Polygon\") then \n if (((x.getsrcname.getname.contains(\"dxf\")).not)\n and ((x.getsrcname.getname.contains(\"dwg\")).not)) then\n (mylist.add(x))\n end\n end\n end\nend\n\npolytheme=msgbox.cho ice(mylist, \"Pick polygon DGN theme:\", \"Polygon theme:\")\nif (polytheme = nil) then exit end\n\n\n'Find out if there is a selected set\nthePolyTable=polytheme.getftab\nif (thePolyTable.GetSelection.Count = 0) then doallpoly=true else doallpoly=false end\n\n'Get the bitmap so we can reset it later\ntheOrigPolyBitmap=PolyTheme.GetFtab.GetLastSelection\n\n'if there is no selected set grab all the polygons\nif (doallpoly) then\n thePolyTable.query(\"([Entity]<>\"\"\"\")\",thePolyTable.GetSelection,#VTAB_SELTYPE_NEW)\n if (theP olyTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no polygon features in the theme!\",\"\")\n exit\n end\n'if there is a selected set get all the polygons in it\nelse\n thePolyTable.query(\"([Entity]<>\"\"\"\")\",thePolyTable.GetSelection,#VTAB_SELTYPE_AND)\n if (thePolyTable.GetSelection.Count = 0) then\n msgbox.info (\"Sorry, no polygon features in selected set!\",\"\")\n exit\n end\nend\n\n'This is where we write all the extra needed files:\npolythemepath=polytheme.getsrcname.getfilename.re turndir\n\nthepolytable.export((polythemepath.asstring+\"\\shape.shp\").asfilename, shape, true)\n\npshape=theme.make(srcname.make(polythemepath.asstring+\"\\shape.shp\"))\nptable=pshape.getftab\nptable.seteditable(true)\nthehandlefield=field.make(\"Handle\",#FIELD_CHAR, 10,0)\nptable.addfields({thehandlefield})\n\n\nfor each record in ptable\n ptable.SetValueString(ptable.findfield(\"handle\"), record, record.asstring)\n end\n\nptable.seteditable(false)\n\n\n\n'Get their tables\ntxtftab=txttheme.getftab\ntxtftab.query(\"([Shape]<>\"\"\" \")\",txtftab.GetSelection,#VTAB_SELTYPE_NEW)\n\npolyftab=ptable\npolyftab.query(\"([Entity]<>\"\"\"\")\",polyftab.GetSelection,#VTAB_SELTYPE_NEW)\n\n'Make a dictionary to put the shape and text in\ntextdict=dictionary.make(200)\n\n'Get the fields in the text table we'll need\ntshp=txtftab.findfield(\"shape\")\nttext=txtftab.findfield(thetextitem.asstring)\n\n'Fill the dictionary with shapes and text\nfor each rec in txtftab.getselection\n shp=txtftab.returnvalue(tshp,rec)\n text=txtftab.returnvalue(ttext,rec)\n textdict.add(shp,tex t)\nend\n\n\n\n'make a table to hold the results - the text value and\n'the handle of the poly the text is in\n\nx=(polythemepath.asstring+\"\\results\").asfilename\n\nthetable=table.make(vtab.makenew(x,dbase))\nav.getproject.adddoc(thetable)\nthetable.setname(\"results\")\nthehandlefield=field.make(\"Handle\",#FIELD_CHAR, 10,0)\nthetextfield=field.make(thetextitem.asstring, #FIELD_CHAR, 10, 0)\nthetable.getvtab.addfields({thehandlefield,thetextfield})\nthetablevtab=thetable.getvtab\n\n\n'Set the fields where the results will go\npte xt=thetablevtab.findfield(thetextitem.asstring)\nphandle=thetablevtab.findfield(\"Handle\")\n\n\n'Get the polygon's shape field\npshp=polyftab.findfield(\"shape\")\n\n'Walk throught the polys and get the shape and handle and closest text\nfor each rec in polyftab.getselection\n polyshp=polyftab.returnvalue(pshp,rec)\n handle=polyftab.returnvalue(polyftab.findfield(\"handle\"),rec)\n \n dist=9999999\n for each sh in textdict.returnkeys\n newdist=polyshp.distance(sh)\n if (newdist < dist) then\n polytext=textdict.g et(sh)\n dist=newdist\n if (dist=0) then break end\n end\n end\n 'Add the found stuff to the new table\n \n if (dist = 0) then\n theRecNum=thetablevtab.addrecord\n thetablevtab.setValue(ptext,theRecNum,polytext)\n thetablevtab.setValue(phandle,theRecNum,handle)\n else\n theRecNum=thetablevtab.addrecord\n thetablevtab.setValue(ptext,theRecNum,\"No text!\")\n thetablevtab.setValue(phandle,theRecNum,\"No handle!\")\n\n end\nend\nthetablevtab.seteditable(false)\n\n'Join the new table back to the polygon table!\npolyftab.findfield(\"Handle\").setvisible(true)\n\npolyftab.join(polyftab.findfield(\"Handle\"),thetablevtab,thetablevtab.findfield(\"Handle\"))\npolyftab.refresh\n\n'write out the joined files to a new shape file so the new items are \n'spatailly joinable\n\n'dgnshp=polythemepath.MakeTmp (\"dgnshp\",\"dbf\")\n'If you want to name the table yourself uncomment the following \n'2 lines and comment the one above.\nnewfilename=polythemepath.maketmp(\"dgnshp\",\"dbf\")\ndgnshp=FileDialog.Put (newfilename, \"dbf\" , \"Save new table as\")\n\nif (dgnshp=nil) then exit end\n\n\npolyftab.export(dgnshp, shape, true)\n'msgbox.info((polythemepath.asstring+\"\\\"+dgnshp.getbasename.left(dgnshp.getbasename.count-3)+\"shp\").asstring,\"real shape\")\nthesrcname=srcname.make(polythemepath.asstring+\"\\\"+dgnshp.getbasename.left(dgnshp.getbasename.count-3)+\"shp\")\n\npshape2=theme.make(thesrcname)\n'msgbox.list(pshape2.getftab.getfields,\"\",\"\")\n\nallfields=pshape2.getftab.getfields\nthebadfields={}\nfor each fieldname in allfields\n'msgbox.info(fieldname. asstring,\"field\")\nif (fieldname.asstring <> \"Shape\") then\nif (fieldname.asstring <> thetextitem.asstring) then\nthebadfields.add(fieldname)\nend\nend\nend\n\n'msgbox.list(thebadfields,\"\",\"\")\n\n'thebadfields=pshape2.getftab.\npshape2.getftab.seteditable(true)\npshape2.getftab.removefields(thebadfields)\npshape2.getftab.seteditable(false)\n\n'Now do the spatial join back to the DGN file\n\npolytheme.getftab.join(polytheme.getftab.findfield(\"Shape\"),pshape2.getftab,pshape2.getftab.findfield(\"Shape\"))\n\n\n'Reset the bitmaps to what they were at the outset\ntheTextTable.SetSelection(theOrigTextBitmap.clone)\ntheTextTable.UpdateSelection\nthePolyTable.SetSelection(theOrigPolyBitmap.clone)\nthePolyTable.UpdateSelection\n\n\n'Now clean up!!\n\n'nuke results table\n\npolyftab.unjoinall\n\nresults=av.getproject.finddoc(\"results\")\nresults.getvtab.unjoinall\nav.getproject.removedoc(results)\nthevtab=results.getvtab\nresults.getvtab.deactivate\nthevtab=nil\nresults=nil\nav.purgeobjects\nfile.delete((polythemepath.asstring+\"\\results.dbf\").asfilename)\n\n\npshap e=theme.make(srcname.make(polythemepath.asstring+\"\\shape.shp\"))\nptable=pshape.getftab\nptable.unjoinall\nav.purgeobjects\n\n'nuke parts of the final shape file we don't need (shp, shx)\nptable.deactivate\nav.purgeobjects\nav.getactivedoc.deletetheme(pshape)\nfor each base in {\"\\\"+dgnshp.getbasename.left(dgnshp.getbasename.asstring.count-3),\"\\shape.\"}\nfor each ext in {\"shp\",\"shx\"}\n file.delete((polythemepath.asstring+base+ext).asfilename)\nend\nend\nav.purgeobjects\n\n'Finally, get rid of the shape.dbf. Note that the o nly file left is\n'dgnshpxx.dbf which was spatially joined back to the DGN.\n'Ah, the power of a spatial join!\npolyftab.unjoinall\npolyftab.deactivate\npolyftab=nil\nav.purgeobjects\n\nfile.delete((polythemepath.asstring+\"\\shape.dbf\").asfilename)\n\n\n\n\n\n\n" ) (Script.96 Name: "c_woff3.ave" SourceCode: "' Turn off all world files!!!\n\n'Get the view and the themes in it\n theview=av.getactivedoc\n thethemelist=theview.getthemes\n for each x in thethemelist\n subname=x.getsrcname.getsubname.asstring\n if (subname <> \"\") then\n\n \n if ((x.getftab.isdrawing = true)and(x.getftab.isworldfileenabled = false)) then\n 'msgbox.info(\"I'm disabled\",\"\") \n \n end\n 'if its a drawing and has world file enabled turn it off\n if ((x.getftab.isdrawing)and(x.getft ab.isworldfileenabled = true) \n and (x.getftab.returnworldfile <> nil)) then\n 'msgbox.info(x.getftab.returnworldfile.asstring,\"worldfile\")\n x.getftab.setworldfileenable(false)\n end \n end\n end\ntheview.invalidate\n \n\n \n \n \n \n \n \n \n \n \n \n\n" ) (Script.97 Name: "c_won3.ave" SourceCode: "' Turn on all world files!!!\n\n'Get the view and the list of themes\n theview=av.getactivedoc\n thethemelist=theview.getthemes\n 'msgbox.list(thethemelist,\"\",\"\")\n for each x in thethemelist\n subname=x.getsrcname.getsubname.asstring\n if (subname <> \"\") then\n\n \n if ((x.getftab.isdrawing = true)and(x.getftab.isworldfileenabled = true)) then\n 'msgbox.info(\"I'm enabled\",\"\") \n \n end\n 'if the theme is a drawing theme and has aworld file enabled, turn it off\n if ((x.getfta b.isdrawing)and(x.getftab.isworldfileenabled = false) \n and (x.getftab.returnworldfile <> nil)) then\n 'msgbox.info(x.getftab.returnworldfile.asstring,\"worldfile\")\n x.getftab.setworldfileenable(true)\n end \n end\n end\ntheview.invalidate\n \n\n \n \n \n \n \n \n \n\n\n" ) (Script.98 Name: "c_about3.ave" SourceCode: "MsgBox.Report (\"The Cadtools extension is designed to help users work with CAD drawing files. This dialog box can be considered the help file.\"\n+nl+nl+\"Make CAD layers - this choice will divide any active CAD themes into a series of themes: one for each layer or level in the CAD file that is currently on in the theme. Each theme will be named with its layer or level name (or number).\"+nl+nl+\n\"Text to point - this choice will convert the active annotation theme to a new shape theme. Each annotation featur e will be converted to a point with the text value in its table in an item called 'CADtext'. This is useful for capturing text values via a point in polygon methodology and allows editing of the feature location.\"\n+nl+nl+\"Text in polygon (DWG) - this choice will prompt for a text (annotation) theme (any source) and an AutoCAD based polygon theme. Text found within the polygon will be joined to that polygon in an item called CADtext. A new table is created that the user can name.\"+nl+nl+\"Block in polygon (DWG) - this choice prompts for a block or point theme and an AutoCAD based polygon theme. Attributes of the blocks or text from the points are added to the bounding polygon. A new table is created that the user can name. Attributes are added to items named after the tag and point items retain the name of the item.\"\n+nl+nl+\"Text in polygon (DGN) - this choice will prompt for a text (annotation) theme (any source) and a MicroStation based polygon theme. Text found within the polygon will be joined to tha t polygon in an item called CADtext. A new table is created that the user can name.\"+nl+nl+\"Block in polygon (DGN) - this choice prompts for a cell or point theme and a MicroStation based polygon theme. Tags of the cell or text from the points are added to the bounding polygon. A new table is created that the user can name. Tags are added to items named after the tag name and point items retain the name of the item.\"\n+nl+nl+\"World files on - this choice will turn all CAD world files in a view on.\"\n+nl+nl +\"World files off - this choice will turn all CAD world files in a view off.\"\n+nl+nl+\"Interactive world file creation - this tool interactively creates a world file for a CAD based theme. By picking a pair (or two pair) of points from a source theme and a target theme a new world file is written and applied to the theme. This tool works best between two views: the source theme is then added (with the world file) to the target view.\"\n+nl+nl+\"Odb tools - two scripts are included c_wrodb.ave and c_rodb.ave that can be used to write out and read in an odb for a 'complex theme'. A complex theme refers to CAD file along with its joined table. These are intended for advanced users and are not available through the interface.\", \"About Cadtools...\")" ) (Script.99 Name: "My Extension Install" SourceCode: "'DO NOT EDIT!!!\n\nif (av.getproject=nil) then return(nil) end\n\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.Get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\nif (aDoc <> nil) then\n\n theProject.addDoc(adoc)\nend\nend\n\n'Add the Controls\n'\nfor each totalControl in theControlList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=to talControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n \n 'Add the control to the control set\n theControlS et.Add(theControl,theCindex)\nend\n\n\n'Add the menus\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0)\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0) +\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n \n if (themenu=NiL) then\n themenu=menu.make\n themenu.setlabel(mMenu)\n theMbar.add(themenu,999) 'puts menu at the end\n \n 'Move menu to the right place - before Window added by ABS 9\\15\\96\n theWinmenu=theMbar.findbylabel(\"Window\")\n theCADmenu=theMbar.findbylabel(\"CAD\")\n themenulist=thembar.getcontro ls.clone\n themenucount=themenulist.count\n theindex=themenuList.FindByValue (theWinmenu)\n \n if (thewinmenu <> nil) then\n thembar.Shift (theCADmenu,(0-(themenucount-theindex-1)))\n end\n 'end of moving the menu around\n ''Now add spaces\n' msgbox.info(\"adding spaces\",\"adding spaces\")\n' thecontrollist=theCADmenu.getcontrols.clone\n' msgbox.info(thecontrollist.count.asstring,\"How many?\")\n' for each x in thecontrollist\n' msgbox.info(x.getlabel,\"label\")\n' if ({\"Text to point\",\"Block in polygon (DWG)\",\"Point in polygon (DGN)\",\"World files on\"}.findbyvalue(x.getlabel)<> -1)\n' then\n' thebase=theCADmenu.getcontrols.find(x)\n' thespace=space.make\n' theCADmenu.add(thespace,thebase)\n' end 'if\n' end 'foreach \n \n end\n \n \n \nthemenu.add(thecontrol, theCindex)\n \n \n \nend\n \n \n'Add the Tool Menus\n\nfor each totalControl in theToolMenuList\n 'The Control list\n acontrol=tot alControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n th escript1=Script.Make(thecommand)\n thecontrolset=av.getproject.findGUI(aControl.get(0)).GetToolBar\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex)\nend\n\n\nav.getproject.setmodified(true)\n\n\n'And the scripts add themselves\n" ) (Script.100 Name: "My Extension Uninstall" SourceCode: "'DO NOT EDIT!!!\n\n'The SELF is the Extension\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n If (theProject.finddoc(adoc.getname)<>NIL) then \n theAnswer=msgbox.yesno(\"Remove the Document \"+adoc.getname+\"?\",\"Remove Document?\",TRUE)\n if (theAnswer=TRUE) then theProject.RemoveDoc(adoc) end\n end\nend\n\n'Removethe Controls\n'\nfor each totalControl in theControlList\n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecommand= \"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n\n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n theControlSet.remove(theControl)\n if (thecontrol = \"ToolBar\") then\n theControlSet.selectdefault\n end\n end\nend\n\n\n'Remove the Menus\n'\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0 )\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n MsgBox.Warning(\"The menu named \"+mMenu+\" is not here.\",\"Script Eror\")\n 'return(nil)\n else\n \n thething=themenu.getcontrols.find(thecontrol)\n if (thething<>NIL) then \n themenu.remove(thecontrol) \n end\n 'msgbox.info(themenu.GetControls.count.asstring,\"\")\n if (themenu.GetControls.count<1) then\n theMbar.remove(themenu)\n end\n end\nend\n \nfor each totalControl in theToolMenuList\n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecontrolset=av.getp roject.findGUI(aControl.get(0)).GetToolBar\n\n \n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n \n theControlSet.remove(theControl)\n theControlSet.selectdefault\n end\n\nend\n \n\n'And the scripts delete themselves\n\n\nav.getproject.setmodified(true)\n" )