Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/17/2022 in all areas

  1. Have a look at this similar request for something I was doing. http://www.theswamp.org/index.php?topic=57938.0 And what I use for CW CCW. ; Checking if pline is CW or CCW and set to CCW ; Orignal idea by Kent Cooper, 1 August 2018 Offsetinorout.lsp ; By Alan H July 2020 (defun AH:chkcwccw (ent / objnew area1 area2 obj minpoint maxpoint) (setq obj (vlax-ename->vla-object ent)) (vla-GetBoundingBox obj 'minpoint 'maxpoint) (setq pointmin (vlax-safearray->list minpoint)) (setq pointmax (vlax-safearray->list maxpoint)) (setq dist (/ (distance pointmin pointmax) 20.0)) (vla-offset obj dist) (setq objnew (vlax-ename->vla-object (entlast))) (setq area1 (vlax-get objnew 'Area)) (vla-delete objnew) (vla-offset obj (- dist)) (setq objnew (vlax-ename->vla-object (entlast))) (setq area2 (vlax-get objnew 'Area)) (vla-delete objnew) (if (> area1 area2) (progn (command "Pedit" ent "reverse" "") ; note bricscad has no REVERSE (setq y (+ y 1)) ) ) )
    2 points
  2. In essence a script file is just a list of commands saved into a file saved with a scr suffix (*.scr) You might have something like this then saved as "scriptfile.scr" PASTECLIP 0,0 to run this as a script you might then use this command - this should paste from the clipboard to point 0,0 using the above example (I am writing this from the top of my head, no checking) (command "_.SCRIPT" "c:\\User\\scriptfile.scr") To make use of a script file then you also want to add in something to open a file like _.OPEN "C:\Users\MyFirstDrawing.dwg" and to close a drawing: (vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "MyFirstDrawing.dwg") :vlax-false) this line just closes the drawing no saving so add that in as well. A quirk I found is that to make it work - for me - I had to open the next file before closing the previous one. Putting it all together you might have a script file like this: _.OPEN "C:\Users\Drawing 1".dwg" PASTECLIP 0,0 qsave _.OPEN "C:\Users\Drawing 2.dwg" (vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "Drawing 1.dwg") :vlax-false) PASTECLIP 0,0 qsave _.OPEN "C:\Users\Drawing 3.dwg" (vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "Drawing 2.dwg") :vlax-false) PASTECLIP 0,0 qsave _.OPEN "C:\Users\Drawing 4.dwg" (vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "Drawing 3.dwg") :vlax-false) PASTECLIP 0,0 qsave (vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "Drawing 3.dwg") :vlax-false) Something like this should run through a range of closed drawings, open them in turn and paste something at 0,0 when you use the (command ....) line from above. It is easier to use a dialogue box to build up the list of files to work on. As for a script to run on only opened files, I have found this to be very limited - happy to be corrected and shown a better way - and the examples out there only show for example switching tabs or similar - certainly not a full range of commands like this example would let you do. The core console is very fast but also limited with some LISP commands like it doesn't like VLA- commands If you can I would consider closing all the files and running the script on them like that - the examples are out there to use Of course, happy to see if someone can answer you with a better solution.
    1 point
  3. Be careful coping blocks that are named the same but are diffrent between drawings. found out text styles named the same but use difrent fonts between drawing also change without notice. or
    1 point
  4. Wblock puts whatever you give it in a new drawing. That's all. It's not like doing a SaveAs because it builds the new file from scratch. All the features you mention are because the garbage in the old drawing doesn't get written to the new drawing.
    1 point
  5. Try the following (command "_.Textmask" (entlast) "") --Edit This is better (acet-textmask-make-wipeout (entlast) 0) ; 0=offset
    1 point
  6. Select block in drawing then the polylines you wish to copy to. https://ibb.co/RphCM36 ;;----------------------------------------------------------------------------;; ;; Copy Block from Insertion Point to Polylines Vertices (defun C:Copy2Poly (/ blk BP SS cords) (setvar 'cmdecho 0) (if (setq blk (car (entsel "\nSelect Block to Copy"))) (progn (redraw blk 3) (setq BP (cdr (assoc 10 (entget blk)))) ;base point of block (if (setq SS (ssget '((0 . "*POLYLINE")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (foreach pt (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent))) (command "_.Copy" blk "" "_non" BP "_non" PT) ) ) ) ) (prompt "\nNothing Selected try again") ) (setvar 'cmdecho 1) (princ) )
    1 point
  7. Hey Bigal, Yes, you are correct, but technically there is 4 scenarios. Text then block, Text then text, block then text or block then block. The idea is to be able to pick either or. Text then getpoint at X or the block and get insertion point at the X, then repeat for the second point. I did post my question on the Autodesk forums and someone posted a great solution. This code is for selecting 1 point. I have simply repeated the same code for the second point. I was also thinking about adding a repeat to the code so I dont have to have the second portion below, but for right now, its doing exactly what I need it to do so I dont want to mess with it. I may explore that when I am more experience/knowledge. Thanks for taking a look at this though BIGAL. Its guys like you that make learning this stuff enjoyable. (defun c:getxyh () (if (and (setq e (car (entsel "Pick elevation: "))) (setq y (cdr (assoc 0 (entget e)))) ) (cond ((= y "INSERT") (setq p (reverse (cdr (reverse (cdr (assoc 10 (entget e)))))) h (atof (cdr (assoc 1 (entget (entnext e))))))) ;; alt. (atof (getpropertyvalue e "ELEV")) ((= y "TEXT") (if (setq p (getpoint "\nFirst grade point: ")) (setq p (reverse (Cdr (reverse p))) h (atof (cdr (assoc 1 (entget e))))))) ((= y "MTEXT") (if (setq p (getpoint "\nFirst grade point: ")) (setq p (reverse (cdr (reverse p))) h (atof (getpropertyvalue e "Text"))))) )) (append p (list h)) )
    1 point
  8. When you do the -insert should also do the add attributes no need to insert then add attributes. If you use (vla-insertblock sp (vlax-3D-point p) n 1.0 1.0 1.0 0.0) then you need to add attributes again though I would use VLA-put function to fill in attributes. Your example has 1 insert but you refer to a csv file does this mean multi blocks to be inserted in 1 dwg ? Post a csv and dwg sample.
    1 point
  9. Can you break the surface into smaller areas ? Everyone jumped on the bandwagon of using drone style surfaces then reality hit like GB files produced. I have one that las file is 245Mb. The design software is still catching up. How much RAM memory do you have may be worth looking at start with 32 GB it may help but no guarantee. You can use say Recap I think to reduce the number of points in the data but that may not be a good idea in some areas.
    1 point
×
×
  • Create New...