Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/04/2019 in all areas

  1. Glad to help .. I used the VLIDE to find it: VLA-PUT-TEXT then CNTRL+SHIFT+A or CNTRL+SHIFT+SPACE
    2 points
  2. This is one particular task where the individual ActiveX properties accessible through Visual LISP are a huge advantage... Consider the following toggle implemented in Visual LISP: (defun c:txtin-visual ( / i o s ) (if (setq s (ssget "_:L" '((0 . "*DIMENSION")))) (repeat (setq i (sslength s)) (setq i (1- i) o (vlax-ename->vla-object (ssname s i)) ) (vlax-put o 'textinside (~ (vlax-get o 'textinside))) ) ) (princ) ) (vl-load-com) (princ) Compared with the corresponding Vanilla AutoLISP solution: (defun c:txtin-vanilla ( / a b e i s x ) (if (setq s (ssget "_:L" '((0 . "*DIMENSION")))) (progn (regapp "ACAD") (repeat (setq i (sslength s)) (setq i (1- i) e (ssname s i) ) (cond ( (not (and (setq x (cdadr (assoc -3 (entget e '("ACAD"))))) (setq a (cdr (member '(1000 . "DSTYLE") x))) ) ) (setq x (append x '( (1000 . "DSTYLE") (1002 . "{") (1070 . 174) (1070 . 001) (1002 . "}") ) ) ) ) ( (not (setq b (cdr (member '(1070 . 174) a)))) (setq x (append (reverse (member '(1000 . "DSTYLE") (reverse x))) '( (1002 . "{") (1070 . 174) (1070 . 001) ) (cdr a) ) ) ) ( (setq x (append (reverse (member '(1000 . "DSTYLE") (reverse x))) (reverse (member '(1070 . 174) (reverse a))) (cons (cons 1070 (- 1 (cdr (assoc 1070 b)))) (cdr b)) ) ) ) ) (entmod (append (entget e) (list (list -3 (cons "ACAD" x))))) ) ) ) (princ) )
    1 point
  3. That's unfortunate. Guess they don't want too much efficiency?
    1 point
  4. Hi Tony, Don't get me wrong, but you don't seem to have enough experience. Where experience != knowledge. Judging by your requests from your posts, all of them can be done with AutoLISP. Here are two examples to create a simple line - AutoLISP : (setq p1 '(5. 5. 0)) (setq p2 '(12. 3. 0.)) (entmakex (cons '(0 . "LINE") (mapcar 'cons '(10 11) (list p1 p2)))) C# (.NET) /source/ : using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; [CommandMethod("AddLine")] public static void AddLine() { // Get the current document and database Document acDoc = Application.DocumentManager.MdiActiveDocument; Database acCurDb = acDoc.Database; // Start a transaction using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) { // Open the Block table for read BlockTable acBlkTbl; acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; // Open the Block table record Model space for write BlockTableRecord acBlkTblRec; acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; // Create a line that starts at 5,5 and ends at 12,3 using (Line acLine = new Line(new Point3d(5, 5, 0), new Point3d(12, 3, 0))) { // Add the new object to the block table record and the transaction acBlkTblRec.AppendEntity(acLine); acTrans.AddNewlyCreatedDBObject(acLine, true); } // Save the new object to the database acTrans.Commit(); } } Its true that AutoLISP is limited (although I don't know by how much and at which aspects), but as you can see its alot simplier to use, shorter and easier to maintain. I only know one huge drawback that is within the DCL dialogs (not enough event handlers for the tiles/controls.. like mouse_hover / mouse_leave ), so you can't be that fancy in there. But as long you get the job done, who cares ? I have this real-life friend that brags about learning the powerful language C#, but also null experience (and doesn't seem that he's about to sit and write some actual code). So when I ask, Q: Ok so what you are able to do with it? A: IDK, but I've heard many things can be done in C# Q: Check out this TicTacToe code I wrote in C# A: Sorry, but I don't understand it and I get lost at it (reason is because when one doesn't practice, isn't able to follow any code's algorithm) So the answer is short - open up that Notepad++/VLIDE/Visual Studio and start to practice, so you'll build your own opinion (and it will change quite few times).
    1 point
×
×
  • Create New...