Jump to content

Search the Community

Showing results for tags 'xdata'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions


  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

Found 10 results

  1. I am creating a program to generate mill slots and to update (using reactors) if a centerline is modified. The only thing I can't figure out is how to handle the reactors for the secondary entities linked to the one being modified. I am currently approaching the problem like so: Each centerline has xdata that contains the handle of the outline followed by the handles of the other linked centerlines. When the magenta line is modified, the outline will be deleted and a new outline will be generated based on the linked items, but that means a new handle needs to be added to the two other lines. (I will have a similar and more complex problem when a new line crosses/interacts with the polylines) I've tried modifying xdata once before and it ended up stuck in a loop. I thought that by modifying the xdata my object modified reactor would trigger but it didn't seem to. I don't have any working code ready to post yet, but what I really could use is some advice or guidance on the logic to trigger my reactors on secondary objects. Thanks for looking!
  2. In the phases of learning something new, the most frustrating thing to me is when the examples make total sense, but you lack just enough understanding to implement it yourself. I can read through Lee Mac's AssociativeCenterlines lisp, and it all makes sense, but I am missing something in my code (and thinking) to make these reactors fully work. Below is the function where I attach the reactors to the objects and all of the reactor code I'm using. The erase reactor seems to work fine, though I wonder about reattaching the reactors afterwards. I assumed doing that would help with the use of the UNDO command. Please correct me if I am wrong or if there is a better way. The modification callback just seems to do nothing. What am I missing? Do I need a reactor for commandended too? (defun SUB:Generate_Dims (circ pt1 pta ptb / ctr dim circe dime) (setq ctr (vlax-get circ 'center) circe (entget (vlax-vla-object->ename circ))) (setq dim (vla-adddimdiametric {MODELSPACE} (vlax-3d-point pta) (vlax-3d-point ptb) pt1 ) dime (entget (vlax-vla-object->ename dim))) (vla-put-textoverride dim (strcat "{\\C5;N.NNNN\\P}<>")) (entmod (list (assoc -1 circe) (list -3 (list wp:app (cons 1002 "{") (cons 1005 (vla-get-handle dim)) (cons 1002 "}") ) ) ) ) (entmod (list (assoc -1 dime) (list -3 (list wp:app (cons 1002 "{") (cons 1005 (vla-get-handle circ)) (cons 1002 "}") ) ) ) ) (vlr-object-reactor (list circ) (list wp:app (vla-get-handle dim)) (list (cons :vlr-erased 'wp:erase:callback) ) ) (vlr-object-reactor (list dim) (list wp:app (vla-get-handle circ)) (list (cons :vlr-modified 'wp:text:callback) (cons :vlr-erased 'wp:erase:callback) ) ) ) ;;; ==== REACTOR FUNCTIONS ==== (defun wp:erase:callback (owner reactor params / h en xR) (if (and (vlax-erased-p owner) (entget (setq en (handent (setq h (cadr (vlr-data reactor)))))) ) (progn (setq xR (vl-remove-if-not (function (lambda (x) (and (eq h (cadr (vlr-data x))) (eq wp:app (car (vlr-data x))) (equal '(:vlr-erased . wp:erase:callback) (car (vlr-reactions x))) ) ) ) (cdar (vlr-reactors :vlr-object-reactor)) ) ) (mapcar 'vlr-remove (cons reactor xR)) (entdel en) (mapcar 'vlr-add (cons reactor xR)) ) ) (princ) ) (defun wp:text:callback (owner reactor params) (setq {data} (list owner reactor)) (vlr-command-reactor (list wp:app) (list (cons :vlr-commandended 'wp:text:modify) (cons :vlr-commandcancelled 'wp:text:cancelled) (cons :vlr-commandfailed 'wp:text:cancelled) ) ) (vlr-remove reactor) (princ) ) (defun wp:text:modify (reactor params / val mm c %) (vlr-remove reactor) (if (and {data} (not (vlax-erased-p (car {data}))) (vlax-read-enabled-p (car {data})) (vlax-write-enabled-p (car {data})) (vlax-property-available-p (car {data}) 'TextOverride) ) (progn (setq val (atof (substr (vl-string-right-trim "\\P}<>" (vla-get-textoverride (car {data}))) 6)) mm (vla-get-measurement (car {data})) % (abs (/ (apply '- (list mm val)) (if (zerop mm) '0.001 mm))) c (cond ((or (zerop val) (>= % '1.0)) "7") ((<= % '0.075) "3") ((and (> % '0.075) (<= % '0.1)) "2") ((> % '0.1) "1") (T "7") ) ) (vla-put-textoverride (car {data}) (strcat "{\\C" c ";" (rtos val 2 3) "\\P}<>")) (vlr-add (cadr {data})) (setq {data} nil) ) ) (princ) ) (defun wp:text:cancelled (reactor params) (vlr-remove reactor) (if {data} (progn (vlr-add (cadr {data})) (setq {data} nil) ) ) (princ) ) ;;; ==== RESTORE REACTOR ASSOCIATION ==== (if (and wp:app (or (tblsearch "APPID" wp:app) (regapp wp:app))) ((lambda (/ ent obj rX dt ss i xtyp xval) (foreach rX (cdar (vlr-reactors :vlr-object-reactor)) (if (and (setq dX (vlr-data rX)) (listp dX) (eq wp:app (car dX)) ) (vlr-remove rX) ) ) (if (setq ss (ssget "_X" (list '(0 . "DIMENSION") (list -3 (list wp:app))))) (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i))) obj (vlax-ename->vla-object ent) xval (caddr (mapcar 'vlax-variant-value (vlax-safearray->list (progn (vla-getxdata obj wp:app 'xtyp 'xval) xval))))) (vlr-object-reactor (list obj) (list wp:app xval) (list (cons :vlr-modified 'wp:text:callback) (cons :vlr-erased 'wp:erase:callback) ) ) ) ) (if (setq ss (ssget "_X" (list '(0 . "CIRCLE") (list -3 (list wp:app))))) (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i))) obj (vlax-ename->vla-object ent) xval (caddr (mapcar 'vlax-variant-value (vlax-safearray->list (progn (vla-getxdata obj wp:app 'xtyp 'xval) xval))))) (vlr-object-reactor (list obj) (list wp:app xval) (list (cons :vlr-erased 'wp:erase:callback) ) ) ) ) )) ) As always, any help/tips/recommendations are greatly appreciated!
  3. I'm creating a script, which automatically adjusts the extended data of line objects. Using information from different blocks in the drawing. I have already finished the first steps. I have already created a temporary layer to which the additional xdata is linked. However, I get stuck on 2 points, Where I need help; Identifies overlapping lines (same geometry) on layer “boundary”. Delete all other objects, So that only the locations where the xdata may have to be adjusted remains (drawing 3) Check if the xdata on bounday layer is present in the underlying objects, and add this information if necessary to the existing xdata. (drawing 4) Please note, it is possible that the underlying objects are 2 objects. It is also possible that these underlying objects, don’t have the same length. Example.dwg test.lsp
  4. I've incorporated and created many LISP functions for surveying purposes in AutoCAD. I've been wanting to share them, so here goes. A lot of the functions reference other functions. I've used the naming scheme: mfcb* for My Functions CBass (me) mfcbLM for My Functions Lee Mac (because he is awesome) Many of these functions have been the work of others and I have revised them to my needs. Use them as you see fit. Enjoy! AutoCAD Blocks Edit: Minor text fixes. Sorry about that. Edit2: Optimizations. Edit3: Optimizations and error fixing. Edit4: More optimizations and a few new functions. Edit5: Optimized SPL function. Edit6: Fixed c:CLOSEST (iNdx was causing infinite loop). Edit7: Fixed multiple selections with c:MASK command (forgot to nil the XData and it would error). Edit8: Formatted Benchmark.lsp for readability. Edit9: Revised XData functions to preserve other application XData. Created menus for the functions. Edit10: Added dropbox link to AutoCAD blocks. Benchmark.lsp PointCodeList.txt acaddoc.lsp Global Functions.LSP Menu.zip
  5. Hi All, After months of playing around (pulling my hair out), I'm finally posting my question because I'm stumped at where to go with this. My lisp skills are a work in progress and are a product or scanning the forum pages over the years. I'm an electrical designer who mainly works with underground HV and LV networks. I'm trying to streamline the way I draft my designs with a lisp capable of exporting my data to populate schedules and such. A standard design consists of (A) electrical pillars (dynamic blocks with attributes and visibility states for pillar type), (B) conduit route between pillars (polyline), © a trench detail block (visibility states to determine the conduit arrangement) and (D) a cable block (visibility states determining the cable type). This is a breakdown of the lisp I've been imagining in my head : Select starting pillar/equipment (A) - Lisp to note the pillars station number attribute and visibility state. Select end pillar/equipment (A) - Same as above. Select trench route between the above mentioned pillars (B) - Pick the conduit polyline. Select trench detail © - Lisp to note the trench details current visibility state. Select cable - Lisp to note the selected cables visibility state. From all of the reading I've done I think the best way is to write all of the gathered information to the conduit/polyline using Xdata. Essentially the conduit polyline Xdata will have the start/end pillar station number, the conduit arrangement and the cable detail. After the Xdata has been written to each conduit/polyline I'd like to be able to export all to a spreadsheet along with the length of each polyline. The following link is probably the closest I've found to what I need, it gave me some issues in exporting and I wasn't quite sure how the data was written. http://www.cadtutor.net/forum/showthread.php?31153-adding-data-to-polyline-and-extracting-this-data-to-table I've attached a file containing the standard blocks I use. If anyone could assist I'd be extremely grateful as you'll be saving me from many many grey hairs! many thanks in advance! AJ Sample.dwg
  6. Sorry I'm pretty new to Xdata, Xrecords & dictionaries and I got some code from "AfraLisp website and I'm trying to modify it to work for what i need. I'm going to store multiple "Part" dictionary information in Xrecords. Then I want to append these dictionaries to an entity (below only shows one dictionary, but in the future I will have "PartL1, PartL2, PartL3" that will all be applied to one entity). Then down the road I will make a lisp that will change the values for the "PartNum" "QTY" & "Spacing" for each. The problem is I can't get the Xrecord dictionary to append to the entity's dictionary. Everything works fine until I get to this line of code: (dictadd ent "PartL1" adict) I don't know if i have the formating correct or I'm referencing this incorrectly. Please help, i've done research and I can't get past this. (defun c:applyassem (/ vars varlist) ;;retrieve XRecord "PartL1" from dictionary "WSI_DICT" ;;which in turn calls both functions below (setq vars (get-or-make-Xrecord)) ;;get dictionary were "PartL1" is stored (setq adict (cdr (car (dictsearch (namedobjdict) "WSI_DICT")))) ;;get entity to app (setq ent (car (entsel))) (dictadd ent "PartL1" adict) (princ) ) (defun get-or-create-Dict (/ adict) ;;test if "WSI_DICT" is already present in the main dictionary (if (not (setq adict (dictsearch (namedobjdict) "WSI_DICT"))) ;;if not present then create a new one and set the main dictionary as owner (progn (setq adict (entmakex '((0 . "DICTIONARY")(100 . "AcDbDictionary")))) ;;if succesfully created, add it to the main dictionary (if adict (setq adict (dictadd (namedobjdict) "WSI_DICT" adict))) ) ;;if present then just return its entity name (setq adict (cdr (assoc -1 adict))) ) );defun (defun get-or-make-Xrecord(/ adict anXrec) (cond ;;first get our dictionary. make here in case it doesn't exit ((setq adict (get-or-create-Dict)) (cond ;;if "WSI_DICT" is now valid then look for "PartL1" Xrecord ((not (setq anXrec (dictsearch adict "PartL1"))) ;;if "PartL1" was not found then create it (setq anXrec (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (7 . "PART#") ;will be part number (90 . 1) ;will be default qty of part (91 . 16) ;will be spacing in inches ) );entmakex );setq anXrec ;;if creation succeeded then add it to our dictionary (if anXrec (setq anXrec (dictadd adict "PartL1" anXrec))) );not ;;if it's already present then just return its entity name (setq anXrec (cdr (assoc -1(dictsearch adict "PartL1"))) );setq anxrex );cond );setq adict );cond );defun
  7. Hi, I am creating lisp routine and the work is to selected Mtext or text and the corresponding content is to be added as Xdata to the selected entity. (defun C:addxdata() (setq a(entget(car(entsel"\nSelect Text: ")))) (setq Xdata1 (cdr (assoc 1 a))) (princ Xdata1) (setq b(entget(car(entsel"\nSelect Text: ")))) (setq Xdata2 (cdr (assoc 1 b))) (princ Xdata2) (regapp "Test_Xdata" ) (setq oldlist (entget (car (entsel)))) (setq thedata '((-3 ("Test_Xdata" (1000 . Xdata1) (1000 . Xdata2 ))))) ) Then I used list Xdata option available under Express tool Tab (Auto Cad 2014). I didn't find any Xdata Attached with it. After Adding the Xdata, I wanna export to Excel. For the Excel Conversion, Lisp is working good. I guess the Problem is in the following line, (setq thedata '((-3 ("Test_Xdata" (1000 . Xdata1) (1000 . Xdata2 ))))) Eventhough the value stored in variable it is not working properly. With Regards, Karunakaran.
  8. Hey, I’m trying to insert xdata to a structured cabling plan, problem is the socket(start) & patch panel (end) are blocks which I connect with a line, and I want the xdata to be the same on the line and on the 2 blocks. Is there a way that I can insert xdata to one of the 3 and automatically be inserted to the other 2 ? I thought of the group command but when I select to insert xdata each of the 3 entities are separate. Thanks
  9. We get this error. We don't know where it came from or how to fix it. When we reload an Xref we get "WARNING: Xdata Tag 100 is missing" scrolling on the screen a bunch of times. It then ends with Dimension disassociated. listed twice. Any help? Often this results in all xref's getting unloaded/detached from the drawing. Thank you!
  10. Hi all, Trying to convert the popular VB VPlayerOff function to VB.Net with added functionality of turning a layer off in all viewports in a layout. My code seems to do everything right except update the Xdata with the new results. I tried manipulating the Xdata result buffer initially but is said it was read only so that is why I have done it this way. I will post the Xdata functions from "From Jerry Winters AU 2009 Class - "Store it in the DWG: XData, Extension Dictionaries and Object Data Through .NET" in a separate post since I went over my allotted 15000 charaters. Note, Current code needs an object on a layer called 'test' in drawing file, with something in the layer . Thanks Mike PS - first time posting so hope I did this right! [size=3][font=Times New Roman][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Interop[/font][/font][/size] [font=Times New Roman][size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Interop.Common[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Runtime[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.DatabaseServices[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.EditorInput[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Geometry[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.ApplicationServices[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.ApplicationServices.[color=#2b91af]Application[/color][/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.LayerManager[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Windows[/font][/size] [size=3][color=blue][font=Consolas]Public[/font][/color][font=Consolas] [color=blue]Class[/color] [color=#2b91af]vbTools[/color][/font][/size] [size=3][font=Consolas]<[color=#2b91af]CommandMethod[/color]([color=#a31515]"VPLOFF"[/color])> _[/font][/size] [size=3][color=blue][font=Consolas]Public[/font][/color][font=Consolas] [color=blue]Sub[/color] VPLOFF()[/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] myDB [color=blue]As[/color] [color=#2b91af]Database[/color] = [color=#2b91af]HostApplicationServices[/color].WorkingDatabase[/font][/size] [size=3][color=blue][font=Consolas]Using[/font][/color][font=Consolas] myTrans [color=blue]As[/color] [color=#2b91af]Transaction[/color] = myDB.TransactionManager.StartTransaction[/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] myBT [color=blue]As[/color] [color=#2b91af]BlockTable[/color] = myDB.BlockTableId.GetObject([color=#2b91af]OpenMode[/color].ForWrite)[/font][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] [color=blue]Each[/color] myBtrID [color=blue]As[/color] [color=#2b91af]ObjectId[/color] [color=blue]In[/color] myBT[/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myBTR [color=blue]As[/color] [color=#2b91af]BlockTableRecord[/color] = myBtrID.GetObject([color=#2b91af]OpenMode[/color].ForWrite)[/font][/size] [size=3][color=blue][font=Consolas] If[/font][/color][font=Consolas] myBTR.IsLayout = [color=blue]True[/color] [color=blue]Then[/color][/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myLayout [color=blue]As[/color] [color=#2b91af]Layout[/color] = myBTR.LayoutId.GetObject([color=#2b91af]OpenMode[/color].ForWrite)[/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myLayoutString [color=blue]As[/color] [color=blue]String[/color] = myLayout.LayoutName[/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myVPIDs [color=blue]As[/color] [color=#2b91af]ObjectIdCollection[/color] = myLayout.GetViewports()[/font][/size] [size=3][color=blue][font=Consolas] For[/font][/color][font=Consolas] [color=blue]Each[/color] myVPortID [color=blue]As[/color] [color=#2b91af]ObjectId[/color] [color=blue]In[/color] myVPIDs[/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myVP [color=blue]As[/color] [color=#2b91af]Viewport[/color] = [color=blue]DirectCast[/color](myTrans.GetObject(myVPortID, [color=#2b91af]OpenMode[/color].ForWrite), [color=#2b91af]Viewport[/color])[/font][/size] [size=3][font=Consolas] DocumentManager.MdiActiveDocument.Editor.WriteMessage(myVP.Layer + vbNewLine)[/font][/size] [size=3][font=Consolas] VpLayerOff([color=#a31515]"test"[/color], myVPortID)[/font][/size] [size=3][font=Consolas] myVP.UpdateDisplay()[/font][/size] [size=3][color=blue][font=Consolas] Next[/font][/color][/size] [size=3][color=blue][font=Consolas] End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]Using[/color][/font][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]Sub[/color][/font][/size] [size=3][color=blue][font=Consolas]Sub[/font][/color][font=Consolas] VpLayerOff([color=blue]ByVal[/color] myVpLyrName [color=blue]As[/color] [color=blue]String[/color], [color=blue]ByRef[/color] myVPID [color=blue]As[/color] [color=#2b91af]ObjectId[/color])[/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] I [color=blue]As[/color] [color=blue]Integer[/color][/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] Counter [color=blue]As[/color] [color=blue]Integer[/color][/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] myResBuff [color=blue]As[/color] [color=#2b91af]ResultBuffer[/color] = GetXData(myVPID, [color=#a31515]"ACAD"[/color])[/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] myNewResBuff [color=blue]As[/color] [color=blue]New[/color] [color=#2b91af]ResultBuffer[/color][/font][/size] [size=3][color=blue][font=Consolas]If[/font][/color][font=Consolas] myResBuff [color=blue]Is[/color] [color=blue]Nothing[/color] = [color=blue]False[/color] [color=blue]Then[/color][/font][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] I = LBound(myResBuff.AsArray) [color=blue]To[/color] UBound(myResBuff.AsArray)[/font][/size] [size=3][color=green][font=Consolas] 'debug print out Xdata[/font][/color][/size] [size=3][font=Consolas] DocumentManager.MdiActiveDocument.Editor.WriteMessage(myResBuff.AsArray(I).TypeCode & vbTab & myResBuff.AsArray(I).Value.ToString & vbNewLine)[/font][/size] [size=3][color=blue][font=Consolas] If[/font][/color][font=Consolas] myResBuff.AsArray(I).TypeCode = 1003 [color=blue]Then[/color][/font][/size] [size=3][font=Consolas] Counter = I + 1[/font][/size] [size=3][color=blue][font=Consolas] If[/font][/color][font=Consolas] myResBuff.AsArray(I).Value.ToString = myVpLyrName [color=blue]Then[/color][/font][/size] [size=3][color=blue][font=Consolas] Exit Sub[/font][/color][/size] [size=3][color=blue][font=Consolas] End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas] End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][color=blue][font=Consolas]Else[/font][/color][/size] [size=3][font=Consolas]MsgBox([color=#a31515]"NO XData under that AppName."[/color])[/font][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas]If[/font][/color][font=Consolas] Counter = 0 [color=blue]Then[/color][/font][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] I = LBound(myResBuff.AsArray) [color=blue]To[/color] UBound(myResBuff.AsArray)[/font][/size] [size=3][color=blue][font=Consolas] If[/font][/color][font=Consolas] myResBuff.AsArray(I).TypeCode = 1002 [color=blue]Then[/color][/font][/size] [size=3][font=Consolas] Counter = I - 1[/font][/size] [size=3][color=blue][font=Consolas] End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=green][font=Consolas]'adds existing data to the new result buffer we are creating[/font][/color][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] I = LBound(myResBuff.AsArray) [color=blue]To[/color] Counter - 1[/font][/size] [size=3][font=Consolas]myNewResBuff.Add([color=blue]New[/color] [color=#2b91af]TypedValue[/color](myResBuff.AsArray(I).TypeCode, myResBuff.AsArray(I).Value))[/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][color=green][font=Consolas]'appends the new frozen layer and closes the set[/font][/color][/size] [size=3][font=Consolas]myNewResBuff.Add([color=blue]New[/color] [color=#2b91af]TypedValue[/color](1003, myVpLyrName))[/font][/size] [size=3][font=Consolas]myNewResBuff.Add([color=blue]New[/color] [color=#2b91af]TypedValue[/color](1002, [color=#a31515]"}"[/color]))[/font][/size] [size=3][font=Consolas]myNewResBuff.Add([color=blue]New[/color] [color=#2b91af]TypedValue[/color](1002, [color=#a31515]"}"[/color]))[/font][/size] [size=3][color=green][font=Consolas]'debug display to see new record buffer[/font][/color][/size] [size=3][font=Consolas]DocumentManager.MdiActiveDocument.Editor.WriteMessage(vbNewLine & vbNewLine)[/font][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] I = LBound(myNewResBuff.AsArray) [color=blue]To[/color] UBound(myNewResBuff.AsArray)[/font][/size] [size=3][color=green][font=Consolas]'debug print out Xdata[/font][/color][/size] [size=3][font=Consolas]DocumentManager.MdiActiveDocument.Editor.WriteMessage(myNewResBuff.AsArray(I).TypeCode & vbTab & myNewResBuff.AsArray(I).Value.ToString & vbNewLine)[/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][font=Consolas]AddXData(myVPID, myNewResBuff)[/font][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]Sub[/color][/font][/size] [size=3][color=blue][font=Consolas]End Class[/font][/color][/size] [/font]
  • Create New...