Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/08/2020 in all areas

  1. Something from me, it can be change for multiple text. (defun c:try1 (/ sel text text2 ) (setq sel (car (entsel "\nSelect some text: "))) (setq text (cdr (assoc 1 (entget sel)))) (setq text2 (vl-list->string (vl-remove 32 (vl-string->list text)))) (entmod (subst (cons 1 text2) (assoc 1 (entget sel)) (entget sel))) (princ) )
    1 point
  2. (while (vl-string-search " " str) (setq str (vl-string-subst "" " " str))) where str is the string you want to change
    1 point
  3. That's what I mean. To you, 0° means North, but to AutoCAD, 0° means the direction of the x-axis (in other words, "East"), not North. And it increases as you go counterclockwise. So it's like a bearing (if you're familiar), except that the bearing's "North" is towards the east and goes counterclockwise. That's how it works in AutoCAD. For your reference, try: Turn Dynamic Input On Start a LINE command Click a point Move your mouse around, and you'll notice how the angle behaves. It's referenced to the positive x-axis of the UCS. That's why I was trying to confirm from my post earlier: "So you basically want to insert a block at the direction of the angle mirrored along a vertical axis as the 0 degrees is to the north. When you click two points, the angle is returned counterclockwise from x-axis. (for instance, if the angle resulting from (angle p1 p2) is 15°, then you want the arrow to be pointing at 165° if I'm understanding it right. If angle supplied is 240°, then arrow points to 300°). Is that right?" I potentially never use (command) because it tends to be at least six times slower, but in your case, you're only inserting one block. And your error is, once again, caused by a spelling mistake ANGT, as opposed to ANGFT Your line (setq ANGF1 (angle REAL1 REAL2)) would return the same thing as getangle either way, so using getangle is shorter, quicker, and easier to use, which is why I used that instead. You probably want to use this then: (defun c:test ( / ang blkname bpt) (setq blkname "ARROWNORTH") (and (setq ang (getangle "\nSpecify angle or click two points <exit>: ")) ; ok thats the angle (setq bpt (getpoint "\nSpecify arrow location <exit>: ")) ; thats the arrow basepoint (entmake (list '(0 . "INSERT") (cons 2 blkname) (cons 10 bpt) '(41 . 1.0) '(42 . 1.0) '(43 . 1.0) (cons 50 (if (< ang pi) (- pi ang) (- (* 3 pi) ang))) ) ) ) (princ) )
    1 point
  4. It's the variable that's wrong. There's no variable ANGF. So when you tried (* -1 angf), it returns the error you described. (defun c:test ( / ang blkname bpt) (setq blkname "ARROWNORTH") (and (setq ang (getangle "\nSpecify angle or click two points <exit>: ")) (setq bpt (getpoint "\nSpecify arrow location <exit>: ")) (entmake (list '(0 . "INSERT") (cons 2 blkname) (cons 10 bpt) '(41 . 1.0) '(42 . 1.0) '(43 . 1.0) (cons 50 (- ang)) ) ) ) (princ) )
    1 point
  5. You are trying to multiply the -1 by a string. ANGTOS outputs a string. you have to do the math before you convert the number to a string. The negative 1 will work with radians too so just apply it to the radians angle.
    1 point
  6. I was merely advising you that to use an angle in the other direction, one only has to put a negative sign in front of it. I do not do lisp nowadays!
    1 point
  7. Look at this line carefully the angle is in opposite direction. (setq ANGF1 (Angtos (angle REAL2 REAL1) 2 0)) ; extracting angle - in degrees and opposite direction (command "-Insert" "ARROWNORTH" NORTH ARROW ANGF1 "" )
    1 point
  8. Whatever the angle is, multiply it by minus one (-1)
    1 point
  9. So you basically want to insert a block at the direction of the angle mirrored along a vertical axis as the 0 degrees is to the north. When you click two points, the angle is returned counterclockwise from x-axis. (for instance, if the angle resulting from (angle p1 p2) is 15°, then you want the arrow to be pointing at 165° if I'm understanding it right. If angle supplied is 240°, then arrow points to 300°). Is that right?
    1 point
  10. I commented the strcat function so its not required and the variable 'ANGF2' is the one that obtains the angle plus ( pi = 180 Degrees ) added to the collected angle.
    1 point
  11. Something like this? (defun C:NA (/ REAL1 REAL2 ARROW ANGF1 ANGF2 NORTH) (if (and (setq REAL1 (getpoint "\nFirst point on background")) ; Real angle point 1 (setq REAL2 (getpoint "\nSecond point on background" REAL1)) ; Real angle point 2 (setq ARROW (getpoint "\nPick arrow basepoint")) (setq ANGF1 (angle REAL1 REAL2)) ; extracting angle - in radians (setq ANGF2 (Angtos (+ ANGF1 pi) 0 2)) ; converting to degrees ;; (setq ANGT (strcat "-" ANGF)) ; attempting to reverse the angle in order to get a mirror image of the angle (setq NORTH (ssget "_:L")) ) (command "Rotate" NORTH "" "_non" ARROW ANGF2) ) (princ) )
    1 point
  12. What object? Blocks? Along what axis? By putting a minus sign, you're mirroring that angle along the x axis. If your object is a block, you can get its rotation by selecting the block and using: (cdr (assoc 50 (entget (car (entsel "\nSelect block: "))))) To me, it sounds like you're trying to draw a north arrow on the direction of the rotation of the original object itself. Still a bit unclear though. Maybe you can post a sample drawing detailing what is original, and what it is you want at the end result.
    1 point
  13. You mean you want to mirror an object? Then why use rotate instead of mirror?
    1 point
×
×
  • Create New...