Jump to content

Leaderboard

Popular Content

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

  1. Speed and more speed, your home work is change the (command "point" pt) to a entmake function, just did 1590 text checks and with code change was like blink and you missed it ALL DONE. Took longer to select and press enter than convert. Maybe get a 2nd Hamster for the power wheel. Double the power.
    2 points
  2. (defun c:cwb ( / ss pt) (if (and (setq pt (getpoint "\nSelect basepoint")) (setq ss (ssget))) (command "_copybase" pt ss ""))) (defun c:pwb () (command "pasteclip" pause))
    1 point
  3. Thanks rlx this one sort of works for me. It only works if you have minimised the window. (vla-put-windowstate excelApp acMax) Also running dual screens. Need a Powershell script. ie winodws OS level. Ok found something now have to remember how to incorporate into a Powershell script and run from CAD, have done it before. $wshell = New-Object -ComObject wscript.shell $wshell.AppActivate('Excel') If you want to try, go bottom right in windows type cmd then powershell paste the 2 lines. Have an Excel open.
    1 point
  4. Added to my do list. Ok try this but note it matches the dwg I have posted. As your dwg is to vague about what goes where. Just open your Excel 1st as more code is required to open a certain file. ; https://www.cadtutor.net/forum/topic/86140-how-to-use-excel-file-xls-file-instead-of-csv-file/ (defun c:amol1234 ( / ss cells cell myxl myrange range start end ss atts att obj str rows col) ; thanks to Lee-mac for this defun ; 58 is Colon (defun csv->lst58 ( str / pos ) (if (setq pos (vl-string-position 58 str)) (cons (substr str 1 pos) (csv->lst58 (substr str (+ pos 2)))) (list str) ) ) ; Alpha2Number - Converts Alpha string into Number ; Function By: Gilles Chanteau from Marseille, France ; Arguments: 1 ; Str$ = String to convert ; Syntax example: (Alpha2Number "ABC") = 731 ;------------------------------------------------------------------------------- (defun Alpha2Number (Str$ / Num#) (if (= 0 (setq Num# (strlen Str$))) 0 (+ (* (- (ascii (strcase (substr Str$ 1 1))) 64) (expt 26 (1- Num#))) (Alpha2Number (substr Str$ 2)) ) ) ) ; ColumnRow - Returns a list of the Column and Row number ; Function By: Gilles Chanteau from Marseille, France ; Arguments: 1 ; Cell$ = Cell ID ; Syntax example: (ColumnRow "ABC987") = '(731 987) ;default to "A1" if there's a problem ;------------------------------------------------------------------------------- (defun ColumnRow (Cell$ / Column$ Char$ Row#) (setq Column$ "") (while (< 64 (ascii (setq Char$ (strcase (substr Cell$ 1 1)))) 91) (setq Column$ (strcat Column$ Char$) Cell$ (substr Cell$ 2) ) ) (if (and (/= Column$ "") (numberp (setq Row# (read Cell$)))) (list (Alpha2Number Column$) Row#) '(1 1) ) ) ;; Thanks to fixo ;; (defun getcell2 (row column / ) (setq cells (vlax-get-property (vlax-get-property myxl "ActiveSheet") "Cells")) (setq cell (vlax-get (vlax-variant-value (vlax-get-property cells "Item" row column)) 'value)) ) (or (setq myxl (vlax-get-object "Excel.Application")) (setq myxl (vlax-get-or-create-object "excel.Application")) ) (vla-put-visible myXL :vlax-true) (vlax-put-property myxl 'ScreenUpdating :vlax-true) (vlax-put-property myXL 'DisplayAlerts :vlax-true) (setq myrange (vlax-get-property (vlax-get-property (vlax-get-property myxl "ActiveSheet") 'UsedRange) 'address)) (setq range (csv->lst58 myrange)) (setq start (vl-string-subst "" "$" (car range))) (setq start (vl-string-subst "" "$" start)) (setq start (columnrow start)) (setq end (vl-string-subst "" "$" (cadr range))) (setq end (vl-string-subst "" "$" end)) (setq end (columnrow end)) (setq lays (layoutlist)) (if (/= (length lays)(- (cadr end) 1)) (progn (alert "Insufficient details compared to number of layouts \n\nWill now exit") (exit) ) ) (setq rows 2) (setq x -1) (repeat (- (cadr end) 1) (setq col 1) (setvar 'ctab (nth (setq x (1+ x)) lays)) (setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "Title_Block_trial")(cons 410 (getvar 'ctab))))) (setq obj (vlax-ename->vla-object (ssname ss 0))) (setq atts (vlax-invoke obj 'Getattributes)) (foreach att atts (setq str (getcell2 rows col)) (vla-put-Textstring att str) (setq col (1+ col)) ) (setq rows (1+ rows)) ) (princ) ) (c:amol1234) Trial (1).dwg
    1 point
  5. Sadly still no time to do any serious lisping, so much to do and so little time ... Anyways , maybe one of these commands : (vlax-put-property excelApp 'visible :vlax-true) (vlax-put-property excelApp 'ScreenUpdating :vlax-true) (vlax-put-property excelApp 'DisplayAlerts :vlax-false) (vla-put-windowstate (vlax-get-acad-object) acMin) (vla-put-windowstate excelApp acMax)
    1 point
  6. I had buttons in excel that would called lisp in cad when I needed to export & work in excel. Might have to add a wait time Sub RunLISPCommand() ' Declare the AutoCAD application object Dim acadApp As AcadApplication ' Get the AutoCAD application object Set acadApp = ThisDrawing.Application ' Send the LISP command to AutoCAD acadApp.ActiveDocument.SendCommand "Your Command HERE" & vbCr ... AppActivate "Microsoft Excel" End Sub Maybe try in https://www.cadtutor.net/forum/forum/57-net-objectarx-amp-vba/
    1 point
×
×
  • Create New...