Recent Posts

Pages: 1 ... 8 9 [10]
91
maybe try not using the move command

Code - C: [Select]
  1.     static void ArxBrxTest_doit()
  2.     {
  3.         ads_name ss{ 0L, 0L };
  4.         TCHAR Kw[10] = { 0 };
  5.         int rc;
  6.         rc = acedSSGet(NULL, NULL, NULL, NULL, ss);
  7.         if (rc != RTNORM) return;
  8.  
  9.         acedInitGet(1, _T("X Y"));
  10.         acedGetKword(_T("\nAlign Direction:<X/Y>"), Kw);
  11.  
  12.         AcGePoint3d pt1, pt2, pt1T;
  13.         acedInitGet(1, NULL);
  14.         rc = acedGetPoint(NULL, _T("\n Select the first point:"), asDblArray(pt1));
  15.         if (rc != RTNORM) return;
  16.  
  17.         acedInitGet(1, NULL);
  18.         rc = acedGetPoint(asDblArray(pt1), _T("\n Select the second point:"), asDblArray(pt2));
  19.         if (rc != RTNORM) return;
  20.  
  21.         AcGePlane plane;
  22.         if (_tcscmp(Kw, _T("X")) == 0)
  23.             plane.set(pt1, AcGeVector3d::kYAxis);
  24.         else
  25.             plane.set(pt1, AcGeVector3d::kXAxis);
  26.  
  27.         pt1T = plane.closestPointTo(pt2);
  28.  
  29.         AcGeMatrix3d xform = AcGeMatrix3d::translation(pt2 - pt1T);
  30.  
  31.         AcDbObjectIdArray ids;
  32.         acedGetCurrentSelectionSet(ids);
  33.         for (auto id : ids)
  34.         {
  35.             if (AcDbEntityPointer pEnt(id, AcDb::kForWrite); pEnt.openStatus() == eOk)
  36.                 pEnt->transformBy(xform);
  37.         }
  38.         acedSSFree(ss);
  39.     }
  40.  
  41.  
92
Thank for your reply . I tried it too but it didn't work.
93
RT3DPOINT instead of RTPOINT?
94
AutoLISP (Vanilla / Visual) / Re: "AutoLISP/XLISP 2.0 migration..." by Tony T
« Last post by JohnK on January 15, 2022, 07:05:33 PM »
I don't know what Lisp for LT is.

The XLisp compiler/interpreters was forked a few times. I am using one of the orig forks (xlisp plus) that was abandoned and made to compile again for x86 and 64 bit stuff many years later. XLisp plus was last updated in 2010, but it still runs good enough to play with.
https://almy.us/xlisp.html

However the orig XLisp was picked back up and ported/updated. You can find that one here:
https://github.com/dbetz/xlisp

The attachment I posted was just Tony's "init file" he used for his version of XLisp (which doesn't work on any new architecture; he probably used his in DOS).

XLisp is just another compiler/engine you find anywhere for countless other languages. TCL, LUA, Python, Perl, Scheme, etc. In Windows no other languages are built in so you have to download a thing like this. Where as in *nix (unix, linux, etc) we have some compilers/interpreters built in to the OS like Perl, python, TCL, etc. but not any Lisp languages (hence, why I had to download a thing like this). But generally speaking, I wouldn't use Lisp (Xlisp, AutoLisp, etc.) to do general scripting though; this was just so I could play around.
95
AutoLISP (Vanilla / Visual) / Re: Calculation lisp -help
« Last post by It's Alive! on January 15, 2022, 07:05:09 PM »
not sure how to do this with lisp, but you can create an expression in fields I.e. %<\AcExpr (2*4)>%
I think LM has lisp tools to work with fields
96
AutoLISP (Vanilla / Visual) / Re: Calculation lisp -help
« Last post by PM on January 15, 2022, 06:37:14 PM »
I try this but is not working

Code - Auto/Visual Lisp: [Select]
  1. (defun c:test ( new old str / inc len )
  2.     (setq len (strlen new)
  3.           inc 0
  4.     )
  5.     (while (setq inc (vl-string-search old str inc))
  6.         (setq str (vl-string-subst new old str inc)
  7.               inc (+ inc len)
  8.         )
  9.     )
  10.     str
  11.   (vl-cmdf "cal" str)
  12. )
  13.  
  14.  

thanks
97
AutoLISP (Vanilla / Visual) / Re: Calculation lisp -help
« Last post by BIGAL on January 15, 2022, 06:09:39 PM »
Post updated, to allow for a string input.

Yes you will need to replace x with * in the text string when you pick the table text, lee-mac.com/stringsubst.html


98
AutoLISP (Vanilla / Visual) / Re: Calculation lisp -help
« Last post by PM on January 15, 2022, 06:04:58 PM »
Is it  possible to select the text , if have x instend of  * to understand it and insert a text with the result ?

Thanks
99
AutoLISP (Vanilla / Visual) / Re: Calculation lisp -help
« Last post by BIGAL on January 15, 2022, 05:48:54 PM »
There was a post I think over at Forums/autodesk convert formula to lisp, pretty sure for simple x*y x-y x+y x/y that has been done. I think did something

Anyway for autocad users Cal. Note no Cal in Bricscad

Command Cal
1234*456
562704

Command: CAL
>> Expression: (1/2 * 59.328 * 102.361) + (1/2 * 16.672 * 85.953)


You can save the cal into a variable
Command: (setq m2 (cal "(1/2 * 59.328 * 102.361) + (1/2 * 16.672 * 85.953)"))
3752.94

(setq str "(1/2 * 59.328 * 102.361)+(1/2 * 16.672 * 85.953)")
Command: (vl-cmdf "cal" str)
3752.94091
3752.94091
100
AutoLISP (Vanilla / Visual) / Re: "AutoLISP/XLISP 2.0 migration..." by Tony T
« Last post by BIGAL on January 15, 2022, 05:36:22 PM »
How about xlisp with LT ? There was a program that allowed lisp with LT Autodesk did not like that and set the lawyers to work.
Pages: 1 ... 8 9 [10]