Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/22/2021 in all areas

  1. I updated the function above so you can feed it degrees rather than radians. (+ (* pi (/ a 180.0)) (vla-get-rotation o)) As for the negative number you were close: (defun c:r2 nil (_myrotator (- (/ pi 2))))
    1 point
  2. If you call the above functions transparently use ' it can be done like so although not sure what is accomplishes
    1 point
  3. http://www.lee-mac.com/groupbynum.html
    1 point
  4. Yesterday morning and this morning I published a pdf with (I thought) the same specs I always used. layouts, paper size and all with a named saved layout. I haven't changed any of that since installing 2019 LT 2 years ago. Now I'm using 2021 and I have been since it was released. Both mornings the pdf's showed up with only the bottom left corner of each of my 11 X 17 layouts filling up each supposedly 11 X 17 pdf page as if the page was actually letter size. Both mornings I had to go and re-set up my publish options as well. They had defaulted to 600 dpi, lines overlap and include layer info, none of which I ever use. The paper size was correct before I reset everything. Once reset and saved, the pdf published correctly. It is as if it is not saving something through a machine shut down and restart. I did shut down and restart AutoCAD a couple of times yesterday and nothing went haywire after the first error. Wonder what I will find tomorrow morning.
    1 point
  5. Just added a simpler starting sequence just window the text and point as a selection or pick. Thanks Kajanthan for the arrow. ; draw a point by grade ; By AlanH April 2021 (defun xyz ( / obj1 obj2 objname ) (if (= (sslength ss) 2) (progn (setq obj1 (vlax-ename->vla-object (ssname ss 0))) (setq objname (vla-get-objectname obj1)) (if(= objname "AcDbMText")(setq z (atof (vla-get-textstring obj1)))) (if (= objname "AcDbText") (setq z (atof (vla-get-textstring obj1)))) (if (= objname "AcDbPoint")(setq pt1 (vlax-get obj1 'coordinates))) (setq obj2 (vlax-ename->vla-object (ssname ss 1))) (setq objname (vla-get-objectname obj2)) (if (= objname "AcDbMText")(setq z (atof (vla-get-textstring obj2)))) (if (= objname "AcDbTEXT") (setq z (atof (vla-get-textstring obj2)))) (if (= objname "AcDbPoint")(setq pt1 (vlax-get obj2 'coordinates))) ) (alert "to many objects picked ") ) (setq x (car pt1) Y (cadr pt1)) ;(princ (strcat "\nyou now have X Y & Z " (rtos x 2 2)" " (rtos y 2 2) " " (rtos z 2 2))) (princ) ) ;;;; Starts here (defun c:grads ( / pt1 pt2 z xy mp dist ang ss) (setq ss (ssget '((0 . "*TEXT,POINT")))) (setq oldaunits (getvar 'aunits)) (setvar 'aunits 3) (xyz) (command "-layer" "M" "Arrow" "") (setq pt2 (getpoint pt1 "Pick 2nd point for ang and distance ")) (setq ang (angle pt1 pt2)) (setq dist (distance pt1 pt2)) (setq grad (getreal "\nEnter gradient X ie 1:X ")) (setq Z (+ Z (/ dist grad))) (command "point" pt2) (command "text" pt2 0.5 0.0 (rtos z 2 3)) (setq mp (mapcar '* (mapcar '+ pt1 pt2) '(0.5 0.5 0.5))) (entmakex (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 8 "Arrow") (cons 90 3) (cons 70 1) (cons 40 0.1) (cons 41 0.1) (cons 10 (polar mp ang (- 1.5) )) (cons 40 0.1) (cons 41 0.1) (cons 10 (polar mp ang 0.5 )) (cons 40 0.5) (cons 41 0.0) (cons 10 (polar mp ang 1.5 )) (cons 40 0.0) (cons 41 0.0) ) ) (setq pt2 (polar mp (+ ang (/ pi 2.0)) 0.5)) (command "text" pt2 0.5 ang (strcat "1:" (rtos grad 2 1))) (setvar 'aunits oldaunits) (princ) )
    1 point
  6. Glad to help Here is a version to rotate all objects with a rotation property: (defun c:foo (/ a e o s) (if (and (setq e (car (entsel "\nPick something to match rotation: "))) (setq a (cdr (assoc 50 (entget e)))) (setq s (ssget ":L")) ) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (vlax-property-available-p (setq o (vlax-ename->vla-object e)) 'rotation) (vla-put-rotation o a) ) ) ) (princ) )
    1 point
  7. Like rlx as I already mention change the get closestpointto to a more direct ssget, also a dwg would explain a lot more. I use (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))) for co-ordinates maybe its faster than get-coordinates and run the convert to list ?
    1 point
  8. Also a drawing or picture (before / after / end result) would make things more clear probably... purpose of your routine is to make a list of which block goes to bed with which poly? Point is , can there be more than one block in 'bed' with the same poly? If not , you could first convert each selection to a list ( (poly-1) ... (poly-700)) and /or ( (block-1) ... (block-900)) and while going through your lists , remove items that are processed from list so each new cycle your list become smaller and smaller and this would mean a much faster routine in the end.
    1 point
×
×
  • Create New...