Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/05/2018 in all areas

  1. You should be able to access the properties and method via lisp, although it wouldn't be as simple as getvar / setvar. In a blank drawing copy and paste this to the command line, then press enter (setq xlApp (vlax-get-or-create-object "Excel.Application")) Then this (vlax-dump-object xlapp T) Pressing F2 to switch to the text window will show you all the properties and methods available for the Excel Application. One of these properties is the Calculation property. In VBA this can be toggled between xlManual (Off) and xlAutomatic (On). Lisp has no ideal about the inbuilt Excel constants and so displays the Integer value -4105 from this page https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.excel.constants?view=excel-pia we can see that xlAutomatic = -4105 and xlManual = -4135 so toggling this property between these two values should toggle Calculation ON and Off. This can be achieved using visual lisp (vlax-put-property xlapp 'calculation -4135);Off (vlax-put-property xlapp 'calculation -4105);On
    2 points
  2. I have just noticed the above. When you construct a list with (cons), the list ends up back to front, so you must (setq pts (reverse pts)) to set it in the correct order you collected the point coordinates (outside the while loop). You haven't done this so when you put the points into the table and give each point a number, the wrong coordinates get given to the point number.
    1 point
  3. To add to the above you can remove everything x and z related as it is never used in the while loop. (SETQ y 2) (SETQ nn 0) (while (< nn n) (SETQ e(nth nn pts)) (SETQ a (CAR e)) (SETQ b (CADR e)) (SETQ c (CADDR e)) (vla-settext objtable y 0 (itoa ptCntr)) (vla-settext objtable y 1 (rtos a 2 3)) (vla-settext objtable y 2 (rtos b 2 3)) (vla-settext objtable y 3 (rtos c 2 3)) (setq y (1+ y)) (setq ptCntr (1+ ptCntr)) (setq nn (1+ nn)) ) Your while loop should now look like this.
    1 point
  4. In the worst case, you can utilise the type library - (setq ImportExcelTypeLibrary ; did ya know that, "Excel.exe" is the type library, thats why "Excel.olb" doesn't exist (lambda ( / IName ICLSID IServer tlb ) ; http://www.theswamp.org/index.php?topic=53368.msg580916#msg580916 ; http://www.theswamp.org/index.php?topic=53389.msg581045#msg581045 (or xlm-AccrInt ; User warning: assignment to protected symbol: xlm-AccrInt <- #<SUBR @0000005022ddfd68 nil> (and (setq IName "Excel.Application") (setq ICLSID (vl-registry-read (strcat "HKEY_CLASSES_ROOT\\" IName "\\CLSID"))) (setq IServer (vl-registry-read (strcat "HKEY_CLASSES_ROOT\\CLSID\\" ICLSID "\\LocalServer32"))) (setq tlb (findfile (vl-string-right-trim "\/automation" IServer))) (vlax-import-type-library :tlb-filename tlb :methods-prefix "xlm-" :properties-prefix "xlp-" :constants-prefix "xlc-" ); vlax-import-type-library ); and ); or ); lambda ); setq ImportExcelTypeLibrary (ImportExcelTypeLibrary) (setq ExcelConstants ; Inspect'n'pretty print, or use assoc (apply (function append) (mapcar (function (lambda (x) (if (wcmatch (vl-symbol-name x) "xlc-*") (list (list x (eval x)))))) (atoms-family 0)) ) ) ;| (assoc 'xlc-xlCalculationAutomatic ExcelConstants) >> (xlc-xlCalculationAutomatic -4105) (assoc 'xlc-xlCalculationManual ExcelConstants) >> (xlc-xlCalculationManual -4135) |; Although it won't be so comfortable as using the Object browser. FWIW, for the rest MS Office applications - (setq ImportMSOTypeLibraries (lambda nil (mapcar (function (lambda (x f / tlb) (or (eval f) (if (findfile (setq tlb (strcat "C:\\Program Files\\Microsoft Office\\Office15\\" (strcase x) ".OLB"))) (progn (setq x (substr x 1 3)) (vlax-import-type-library :tlb-filename tlb :methods-prefix (strcat x "-m-") :properties-prefix (strcat x "-p-") :constants-prefix (strcat x "-c-") ); vlax-import-type-library ); progn ); if ); or ); lambda ); function '("MSWord" "MSAcc" "MSOutl" "MSPpt") ; Word, Access, Outlook, PowerPoint '(MSW-m-Accept MSA-m-Add MSO-m-Activate MSP-m-Activate) ; The very first User warning: assignment to protected symbol ); mapcar ); lambda ); setq ImportMSOTypeLibraries ; (ImportMSOTypeLibraries) ;| (assoc 'PowerPoint MSOconstants) (assoc 'Word MSOconstants) (assoc 'Outlook MSOconstants) |; (setq MSOconstants ( (lambda ( / L n ) (foreach x (apply (function append) (mapcar (function (lambda (x) (if (wcmatch (vl-symbol-name x) "MS@-c-*") (list x)))) (atoms-family 0))) (if (setq n (vl-position (substr (vl-symbol-name x) 3 1) '("W" "A" "O" "P"))) (progn (setq x (list x (eval x))) (setq L (cons (nth n (list (list x nil nil nil) (list nil x nil nil) (list nil nil x nil) (list nil nil nil x) ) ) L ) ); setq L ); progn ); if ); foreach (setq L (mapcar (function (lambda (x) (vl-remove nil x))) (apply 'mapcar (cons 'list L)))) (mapcar 'cons '(Word Access Outlook PowerPoint) L) ) ) ); setq MSOconstants
    1 point
  5. Nice link, FWIW the objects/methods/properties/constants and events in the Excel applicaiton can be observed through the built-in VBAIDE, by running it and creating a new module, then right click->Object Browser
    1 point
  6. This is not a bug. Signed integers are stored in 32-bit 2's complement representation and so we have the following when performing the bitwise operations: (boole 9 0 1) = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 = 1 ----------------------------------------------------------------------- NOT XOR 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 = -2
    1 point
  7. The vast majority of the feedback I've received about the new forum software has been positive and I'm very grateful to everyone who flagged up issues and contributed to making the migration a success. Now that the dust has settled, it's a good time to hone your skills. There is way more to the Invision Community interface than it initially appears, so I thought you might like a link to this blog post from the developers. I'm sure you'll find something useful here that will make your forum interactions even better. 5 Secret Interface Tips If you have a top tip for using this forum, just add it to this thread.
    1 point
×
×
  • Create New...