Author Topic: Why isn't my osmode setting changing?  (Read 2138 times)

0 Members and 1 Guest are viewing this topic.

bman

  • Guest
Why isn't my osmode setting changing?
« on: June 21, 2005, 09:15:09 PM »
Why isn't my osmode changing to intersection @ line 12? Do I have it in the wrong place? I want it to change prior to issuing the rotate command.
Code: [Select]
(defun c:cir (/ osmd rw bldg pad padendp dist)
  (setq osmd (getvar "osmode"))
  (setvar "cmdecho" 0)
  (setvar "osmode" 4)
  (setq rw (getpoint "\nSnap to Center of R/W Arc: "))
  (setvar "osmode" 1)
  (setq bldg (getpoint "\nSelect Endpoint of Bldg. Front: "))
  (setq dist (distance rw bldg))
  (command "circle" rw dist)
  (setq pad (entsel "\nSelect Bldg. Pad: "))
  (setq padendp (getpoint "\nSelect Pad Endpoint Near Lot Line: "))
  (setvar "osmode" 32)
  (command "rotate" pad "" rw "r" rw padendp)
  (setvar "osmode" osmd)
 )

bman

  • Guest
Why isn't my osmode setting changing?
« Reply #1 on: June 21, 2005, 09:49:39 PM »
nevermind I just figured it out

daron

  • Guest
Why isn't my osmode setting changing?
« Reply #2 on: June 22, 2005, 08:27:09 AM »
I don't know if you'd like it, but if you'd like a rubber-band line from pad point to padendp you could do this:
Code: [Select]
(setq padendp (getpoint (cadr pad) "\nSelect Pad Endpoint Near Lot Line: "))

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Why isn't my osmode setting changing?
« Reply #3 on: June 22, 2005, 09:18:05 AM »
How about some error checking.
If you abort or fail to pick it will quit and remove the circle.
You may need to tweak to suite you specific needs but it is a start.

Code: [Select]
(defun c:cir (/ *error* osmd rw bldg pad padendp dist)
  ;; error function & Routine Exit
  (defun *error* (msg)
    (if
      (not
        (member
          msg
          '("console break" "Function cancelled" "quit / exit abort" "")
        )
      )
       (princ (strcat "\nError: " msg))
    ) ; endif

    ;;reset all variables here
    (if cir (entdel cir))
    (setq cir nil)
    (setvar "osmode" osmd)
  )

 
  (setq osmd (getvar "osmode"))
  (setvar "cmdecho" 0)
  (setvar "osmode" 4)
  (if
    (and
      (setq rw (getpoint "\nSnap to Center of R/W Arc: "))
      (setvar "osmode" 1)
      (setq bldg (getpoint "\nSelect Endpoint of Bldg. Front: "))
      (setq dist (distance rw bldg))
      (setvar "osmode" 0)
      (not (command "circle" rw dist))
      (setq cir (entlast))
      (setvar "osmode" 1)
      (setq pad (entsel "\nSelect Bldg. Pad: "))
      (setq
        padendp (getpoint (cadr pad) "\nSelect Pad Endpoint Near Lot Line: ")
      )
      (setvar "osmode" 32)
      (not (command "rotate" pad "" rw "r" rw padendp pause))
    )
     (prompt "\n***  Command complete  ***")
     (progn
       (prompt "\n***  Command Aborted  ***")
       (if cir (entdel cir))
     )
  )
  (*error* "")
  (princ)
)
(prompt "\nCircle Loaded, Enter Cir to run.")
(princ)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

bman

  • Guest
Why isn't my osmode setting changing?
« Reply #4 on: June 22, 2005, 10:34:25 AM »
Sweet! Thanks for the tips.

bman

  • Guest
Why isn't my osmode setting changing?
« Reply #5 on: June 22, 2005, 10:49:59 AM »
How do I get the rubber band effect  between these two points?
Code: [Select]
     (setq rw (getpoint "\nSnap to Center of R/W Arc: "))
      (setq bldg (getpoint  "\nSelect Endpoint of Bldg. Front: "))

I tried this but it didn't work:
Code: [Select]
     (setq rw (getpoint "\nSnap to Center of R/W Arc: "))
      (setq bldg (getpoint (cadr rw) "\nSelect Endpoint of Bldg. Front: "))

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Why isn't my osmode setting changing?
« Reply #6 on: June 22, 2005, 10:52:32 AM »
i think you only need :
Code: [Select]
(setq rw (getpoint "\nSnap to Center of R/W Arc: "))
      (setq bldg (getpoint rw "\nSelect Endpoint of Bldg. Front: "))
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Why isn't my osmode setting changing?
« Reply #7 on: June 22, 2005, 10:54:37 AM »
The cadr from Daron's example was because you used entsel to grab the building.  In this case, your are using an existing point your just defined, rw.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

bman

  • Guest
Why isn't my osmode setting changing?
« Reply #8 on: June 22, 2005, 11:25:25 AM »
Thanks for the tip!

daron

  • Guest
Why isn't my osmode setting changing?
« Reply #9 on: June 22, 2005, 12:09:56 PM »
If you want a rectangular rubber-banding effect for any reason, just repleace the second points getpoint with getcorner.