Jump to content

Search the Community

Showing results for tags 'xdata'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 7 results

  1. 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
  2. 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
  3. 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
  4. 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.
  5. 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
  6. 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!
  7. 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...