Johntosh Posted November 8, 2008 Posted November 8, 2008 I'm currently getting errors...  ActiveX Server returned the error: unknown name: Path ActiveX Server returned the error: unknown name: Linetype ActiveX Server returned the error: unknown name: IsXref  ...even though I have (vl-load-com) at the top of the function.  Any assistance appreciated. Quote
ASMI Posted November 8, 2008 Posted November 8, 2008 Your object hasn't this properties. Use vlax-property-available-p function to check it. For example get ActiveDocument object and check path property:  Command: (setq actDoc(vla-get-ActiveDocument(vlax-get-acad-object))) #<VLA-OBJECT IAcadDocument 01ffa950> Command: (vlax-property-available-p actDoc 'Path) T Command: (vla-get-Path actDoc) "C:\\Documents and Settings\\Administrator\\My Documents"  It exists. Now check Linetype property:  Command: (vla-get-Linetype actDoc 'Linetype) ; error: ActiveX Server returned the error: unknown name: Linetype  This property missed in ActiveDocument object. To look list of all properties and methods for each object use vlax-dump-object function and the ActiveX and VBA Reference inside Developer Help:  Command: (vlax-dump-object actDoc t) ; IAcadDocument: An AutoCAD drawing ; Property values: ; Active (RO) = -1 ; ActiveDimStyle = #<VLA-OBJECT IAcadDimStyle 0e7f4fac> ; ActiveLayer = #<VLA-OBJECT IAcadLayer 0e826a6c> ; ActiveLayout = #<VLA-OBJECT IAcadLayout 0e826a1c> ; ActiveLinetype = #<VLA-OBJECT IAcadLineType 0e826abc> ; ActiveMaterial = #<VLA-OBJECT IAcadMaterial 0e8266fc> ; ActivePViewport = AutoCAD: No active viewport in paperspace ; ActiveSelectionSet (RO) = #<VLA-OBJECT IAcadSelectionSet 0e7d925c> ; ActiveSpace = 1 ; ActiveTextStyle = #<VLA-OBJECT IAcadTextStyle 0e826b0c> ; ActiveUCS = AutoCAD: Null object ID ; ActiveViewport = #<VLA-OBJECT IAcadViewport 0e826b5c> ; Application (RO) = #<VLA-OBJECT IAcadApplication 00d73d3c> ; Blocks (RO) = #<VLA-OBJECT IAcadBlocks 0e826bac> ; Database (RO) = #<VLA-OBJECT IAcadDatabase 0e7d850c> ; Dictionaries (RO) = #<VLA-OBJECT IAcadDictionaries 0e826bfc> ; DimStyles (RO) = #<VLA-OBJECT IAcadDimStyles 0e826c4c> ; ElevationModelSpace = 0.0 ; ElevationPaperSpace = 0.0 ; FileDependencies (RO) = #<VLA-OBJECT IAcadFileDependencies 0e8309ec> ; FullName (RO) = "" ; Groups (RO) = #<VLA-OBJECT IAcadGroups 0e826c9c> ; Height = 702 ; HWND (RO) = 396484 ; Layers (RO) = #<VLA-OBJECT IAcadLayers 0e826cec> ; Layouts (RO) = #<VLA-OBJECT IAcadLayouts 0e826d3c> ; Limits = (0.0 0.0 420.0 297.0) ; Linetypes (RO) = #<VLA-OBJECT IAcadLineTypes 0e826d8c> ; Materials (RO) = #<VLA-OBJECT IAcadMaterials 0e826ddc> ; ModelSpace (RO) = #<VLA-OBJECT IAcadModelSpace2 0e826e2c> ; MSpace = AutoCAD: Invalid mode ; Name (RO) = "Drawing1.dwg" ; ObjectSnapMode = 0 ; PaperSpace (RO) = #<VLA-OBJECT IAcadPaperSpace2 0e826e7c> ; Path (RO) = "C:\\Documents and Settings\\Administrator\\My Documents" ; PickfirstSelectionSet (RO) = #<VLA-OBJECT IAcadSelectionSet 0e7d95ec> ; Plot (RO) = #<VLA-OBJECT IAcadPlot 0e830e2c> ; PlotConfigurations (RO) = #<VLA-OBJECT IAcadPlotConfigurations 0e826ecc> ; Preferences (RO) = #<VLA-OBJECT IAcadDatabasePreferences 0e8309c4> ; ReadOnly (RO) = 0 ; RegisteredApplications (RO) = #<VLA-OBJECT IAcadRegisteredApplications 0e826f1c> ; Saved (RO) = 0 ; SectionManager (RO) = Exception occurred ; SelectionSets (RO) = #<VLA-OBJECT IAcadSelectionSets 0e7fb50c> ; SummaryInfo (RO) = #<VLA-OBJECT IAcadSummaryInfo 0e830a8c> ; TextStyles (RO) = #<VLA-OBJECT IAcadTextStyles 0e826f6c> ; UserCoordinateSystems (RO) = #<VLA-OBJECT IAcadUCSs 0e826fbc> ; Utility (RO) = #<VLA-OBJECT IAcadUtility 0e8349a4> ; Viewports (RO) = #<VLA-OBJECT IAcadViewports 0e82700c> ; Views (RO) = #<VLA-OBJECT IAcadViews 0e82705c> ; Width = 1066 ; WindowState = 3 ; WindowTitle (RO) = "Drawing1.dwg" ; Methods supported: ; Activate () ; AuditInfo (1) ; Close (2) ; CopyObjects (3) ; EndUndoMark () ; Export (3) ; GetVariable (1) ; HandleToObject (1) ; Import (3) ; LoadShapeFile (1) ; New (1) ; ObjectIdToObject (1) ; Open (2) ; PurgeAll () ; Regen (1) ; Save () ; SaveAs (3) ; SendCommand (1) ; SetVariable (2) ; StartUndoMark () ; Wblock (2) T Quote
Johntosh Posted November 8, 2008 Author Posted November 8, 2008 Thanks for your help, ASIM. Â One thing I don't get is if I have already a linetype collection then why isn't an item of the collection recognised as a linetype? Â (defun c:test () (vl-load-com) (vlax-for item (vla-get-linetypes (vla-get-activedocument (vlax-get-acad-object))) (if (= (vla-get-linetype item) :vlax-true) (princ item) ) (princ) ) Quote
ASMI Posted November 8, 2008 Posted November 8, 2008 why isn't an item of the collection recognised as a linetype? Â Because Linetype (Item of Linetypes) is also object which have the Name property: Â (defun c:test () (vl-load-com) (vlax-for item (vla-get-linetypes (vla-get-activedocument (vlax-get-acad-object))) (princ(strcat "\n"(vla-get-Name item))) ) (textscr) (princ) ) Quote
Johntosh Posted November 8, 2008 Author Posted November 8, 2008 Thank you, ASIM. I really appreciate your tutelage. Â I've been at this juncture before between entities and names of entites and propertoes thereof! Â Thanks again, enjoy the weekend. Â God bless you. Quote
sivapathasunderam Posted October 7, 2021 Posted October 7, 2021 Help to correct below route ! I wanted to have all line types as text file  (defun c:testline ( / item fileName fn exlintyp ) (vl-load-com) (setq fileName "D:\\MyLineTypeTextFile.txt") (vlax-for item (vla-get-linetypes (vla-get-activedocument (vlax-get-acad-object))) (princ (strcat "\n"(vla-get-Name item )))) (princ (strcat "\nTotal of " (itoa (sslength item )) " Line Type(s) ... " )) (progn (setq fn (open fileName "w")) (setq exlintyp (vla-get-Name item)) (textscr) (write-line exlintyp fn) (close fn)) (princ))  1 Quote
BIGAL Posted October 7, 2021 Posted October 7, 2021 (edited) My take  (defun c:testline ( / item fileName fn exlintyp ) (vl-load-com) (setq fileName "D:\\MyLineTypeTextFile.txt") (setq lines (vla-get-linetypes (vla-get-activedocument (vlax-get-acad-object)))) (princ (strcat "\nTotal of " (itoa (vla-get-count lines)) " Line Type(s) ... " )) (setq fn (open fileName "w")) (vlax-for LT lines (princ (strcat "\n"(vla-get-Name LT ))) (setq exlintyp (vla-get-Name LT)) (write-line exlintyp fn) ) (close fn) (princ) ) (c:testline)  Another similar task just did this for a particular problem.  ; draw all linetypes as a look at ; By AlanH Oct 2021 (setq pt (getpoint "\nPick a point for linetypes")) (setq lts (vla-get-linetypes (vla-get-activedocument (vlax-get-acad-object)))) (setq lst '()) (vlax-for ltname lts (setq ltn (vla-get-name ltname)) (princ (strcat "\n" ltn)) (if (or (= ltn "ByBlock")(= ltn "ByLayer")) (princ "ByBlock or Bylayer") (setq lst (cons ltn lst)) ) ) (setq lst (vl-sort lst '<)) (foreach lt lst (setq pt2 (mapcar '+ pt (list 60.0 0.0 0.0))) (command "Line" pt pt2 "") (vla-put-linetype (vlax-ename->vla-object (entlast)) lt) (setq pt2 (mapcar '+ pt (list 75.0 0.0 0.0))) (command "text" pt2 3.5 0.0 lt) (setq pt (mapcar '+ pt (list 0.0 -10.0 0.0))) )  Edited October 7, 2021 by BIGAL 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.