Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/07/2024 in all areas

  1. (defun c:11 (/) (setq ent (vlax-ename->vla-object (car (entsel))) lat (vla-get-latitude ent) lon (vla-get-longitude ent) ) (alert (strcat "Latitude = " lat "\nLongitude = " lon)) )
    3 points
  2. Something like this: (defun C:POSM-TO-CSV ( / doc fil sel lst hdr ) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (cond ((null (setq fil (getfiled "Save CSV:" (if (= 1 (getvar 'dwgtitled)) (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) ) (strcat "C:\\" (vl-filename-base (getvar 'dwgname))) ) "csv" 1 ) ) ) (princ "\n*Cancel*") ) ((null (ssget '((0 . "POSITIONMARKER"))))(princ "\nInvalid Selection.")) ( t (vlax-for x (setq sel (vla-get-ActiveSelectionSet doc)) (setq lst (cons (list (vla-get-latitude x)(vla-get-longitude x)) lst)) ) (setq lst (mapcar '(lambda ( x ) (list (car x) (cadr x))) lst)) (setq hdr (cons (list "<Latitude>" "<Longitude>") hdr)) (LM:WriteCSV (setq lst (append hdr lst)) fil) (princ "\nPlease Wait, Opening CSV File in Excel...") (startapp "Explorer" fil) (vla-delete sel) ) ) (princ) ) Requires Lee Mac's WriteCSV
    2 points
  3. Yes can be done. If need more help just post Need to edit the plot lsp to suit your title block. Need to down load ghostscript and edit the code to suit its install location and version number. plotA3Pdfrange2.lsp Multi GETVALS.lspmergepdfs.lsp
    1 point
  4. Thanks so much Steven, Sorry for the late reply. This worked perfectly. Much appreciated.
    1 point
  5. Nikon have a look at the dcl I made using Multi Radio Buttons.lsp, when you select a button, the variable BUT is returned with the button number, so you can use a cond looking at the BUT value, for the {} just need a (cond ((= but 1)(setq str (strcat (chr 92) (chr 123)) txt (strcat (chr 92) (chr 125))))) ((= but 2)(setq str (strcat "[" txt "]"))) .... )
    1 point
  6. Use DATE instead of CDATE: https://help.autodesk.com/view/ACD/2023/ENU/?guid=GUID-CBB24068-1654-4753-BE2E-1D0CE9700411 DATE stores the date value as a Julian date, which simply counts the number of days which have elapsed from a given epoch - as such, you can easily subtract two integer Julian date values to calculate the number of elapsed days between two dates, e.g.: (< 7 (- (getvar 'date) (atoi (getenv "TELNUMBERS")))) (assuming you have changed TELNUMBERS to store the DATE value instead of CDATE)
    1 point
  7. You don't need another script. But here's one anyway. Maybe it helps someone who needs parts of this code some day command Test2 (vl-load-com) ;; if no parameter if given, then a list of all layers is given. ;; if a layer is given, the function returns True when the layer is "On", "not frozen" and "not locked". Else nil is returned (defun get_layers (lay / lyr table ret) (setq ret T) (vlax-for lyr (vla-get-layers (vla-get-activedocument (vlax-get-acad-object) ) ) (if (= (vla-get-name lyr) lay) (if (and (= :vlax-true (vla-get-layeron lyr)) (= :vlax-false (vla-get-freeze lyr)) (= :vlax-false (vla-get-lock lyr)) ) (setq ret T) (setq ret nil) ) ) (setq table (cons (vla-get-name lyr) table)) ) (if lay ret table ) ) (defun c:test ( / ) (get_layers nil) ) (defun c:test2 ( / ss ss2 i) (setq ss (ssget "_X" (list (cons 0 "*POLYLINE")))) (setq i 0) (setq ss2 (ssadd)) (repeat (sslength ss) (setq obj (ssname ss i)) (if (get_layers (cdr (assoc 8 (entget obj)))) ;; will skip things of layers that are off/frozen/locked (setq ss2 (ssadd (ssname ss i) ss2)) ) (setq i (+ i 1)) ) (sssetfirst nil ss2) (princ) )
    1 point
  8. It isn't AutoLISP functions but properties and methods of ActiveX objects. You can find it in ActiveX and VBA reference inside Developer Help. There syntax VBA is used, however to use them in syntax AutoLISP not difficult. Draw a line and type in command line and pick line: Command: (vl-load-com) Command: (setq vObj(vlax-ename->vla-object(car(entsel)))) Select object: #<VLA-OBJECT IAcadLine 026386b4> Now you have ActiveX object of your line. Look all properties and methods by mean of vlax-dump-object function: Command: (vlax-dump-object vObj T) ; IAcadLine: AutoCAD Line Interface ; Property values: ; Angle (RO) = 0.657912 ; Application (RO) = #<VLA-OBJECT IAcadApplication 00d73d3c> ; Delta (RO) = (584.602 451.76 0.0) ; Document (RO) = #<VLA-OBJECT IAcadDocument 090902a8> ; EndPoint = (1887.85 1143.92 0.0) ; Handle (RO) = "1AD" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0edfe97c> ; Layer = "0" ; Length (RO) = 738.815 ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 2130342760 ; ObjectName (RO) = "AcDbLine" ; OwnerID (RO) = 2130337016 ; PlotStyleName = "ByLayer" ; StartPoint = (1303.24 692.161 0.0) ; Thickness = 0.0 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0ee0de10> ; Visible = -1 ; Methods supported: ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; Delete () ; GetBoundingBox (2) ; GetExtensionDictionary () ; GetXData (3) ; Highlight (1) ; IntersectWith (2) ; Mirror (2) ; Mirror3D (3) ; Move (2) ; Offset (1) ; Rotate (2) ; Rotate3D (3) ; ScaleEntity (2) ; SetXData (2) ; TransformBy (1) ; Update () T Now get object color: Command: (vla-get-color vObj) 256 And change it to Red: Command: (vla-put-Color vObj 1) nil As you see vla- functions is object properties. vla-get- serves to get properties and vla-put- to change properties. Now apply Offset method to your line: Command: (setq Res(vla-offset vObj -15)) #<variant 8201 ...> Variable Res is variant-safearray with a new objects. Transform it to list: Command: (vlax-safearray->list(vlax-variant-value Res)) (#<VLA-OBJECT IAcadLine 02638954>)
    1 point
  9. Sorry, I miss read it, ‘58s is a better approach
    0 points
×
×
  • Create New...