Author Topic: line with attribute tool  (Read 10062 times)

0 Members and 2 Guests are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
line with attribute tool
« Reply #30 on: December 06, 2004, 06:17:23 PM »
Do the procedure at command line then repeat each entry.
Code: [Select]
Command: -layer

Current layer:  "S4"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/PStyle/Freeze/Thaw/LOck/Unlock]:
 m

Enter name for new layer (becomes the current layer) <S4>: S-BEAM
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/PStyle/Freeze/Thaw/LOck/Unlock]:
 c

Enter color name or number (1-255): 5

Enter name list of layer(s) for color 5 (blue) <S-BEAM>:
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/PStyle/Freeze/Thaw/LOck/Unlock]:


Code: [Select]
(command "-layer" "m" "S-BEAM" "c" "5" "" "")
Where did the ^c come from? Don't use it.
When you use the MAKE option it sets that layer current so you don't need clayer.

To make a layer if it doesn't exist or set current use this code
Code: [Select]
(setq lyr "S-BEAM")
(if (not (tblsearch "layer" lyr))
 (command "._layer" "m" lyr "c" "5" "" "")
 (command "._Layer" "_Thaw" lyr "_On" lyr "_UnLock" lyr "_Set" lyr "")
)
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.

whdjr

  • Guest
line with attribute tool
« Reply #31 on: December 07, 2004, 10:45:33 AM »
Quote from: Mark Thomas
dang!! beat by one minute.

 :D  :D  :D

dubb

  • Swamp Rat
  • Posts: 1105
line with attribute tool
« Reply #32 on: December 07, 2004, 01:20:13 PM »
cab, that is a gr8 way to learn. my other question is

Code: [Select]
(command "-layer" "m" "S-BEAM" "c" "5" "" "")

what are the following quotes used for? is there a rule for using the quotes?
what im talking about is the
Quote
(.....""  "")
after the
Quote
"5"
[/quote]

CADaver

  • Guest
line with attribute tool
« Reply #33 on: December 07, 2004, 01:40:36 PM »
Quote from: dubb
cab, that is a gr8 way to learn. my other question is

Code: [Select]
(command "-layer" "m" "S-BEAM" "c" "5" "" "")

what are the following quotes used for? is there a rule for using the quotes?
what im talking about is the
Quote
(.....""  "")
after the
Quote
"5"

They execute "ENTER" after the layer color command to accept the default layer name for color 5, then exit the layer loop.

dubb

  • Swamp Rat
  • Posts: 1105
line with attribute tool
« Reply #34 on: December 10, 2004, 12:51:38 PM »
im back again....here is another version of my beam command. except i stilll cant get that block on the midpoint (pt3) and also when i insert the block it doesnt align with the direction i place "pt1 and pt2" unless it wasnt at an angle, any suggestions?

Code: [Select]

(defun c:bm (/ pt1 pt2 pt3 newpt1 newpt2)
(setq pt1 (getpoint "\nPick First Beam Point:")
        pt2 (getpoint pt1 "\nPick Second Beam Point:"))
   ;comment here
(command "layer" "make" "S-BEAM" "color" 5 "" "")
(command "clayer" "s-beam")
(setq newpt1 (polar pt1 (angle pt1 pt2) 3))
(setq newpt2 (polar pt2 (angle pt2 pt1) 3))
(setq pt3 (polar pt2 (angle pt1 pt2) (/ (distance pt1 pt2) 2)))
(entmake (list '(0 . "LINE")
          (cons 10 newpt1)
          (cons 11 newpt2)
 
          )
    )
(command "layer" "make" "S-BM-TEXT" "color" 1 "" "")
(command "clayer" "S-BM-TEXT")
(COMMAND "-insert" "BM-TEXT" pt3 "" "" (angle pt1 pt2))

(princ)
)   ;end defun

CADaver

  • Guest
line with attribute tool
« Reply #35 on: December 10, 2004, 01:06:31 PM »
If you're puling the angle between PT1 and PT2 start your (POLAR from PT1.  YOu could also use:
Code: [Select]
(cal "(pt1+pt2) /2")
The angle requested after the insert command is in degrees (angle PT1 PT2) returns radians, you need to convert.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
line with attribute tool
« Reply #36 on: December 10, 2004, 02:07:07 PM »
Read each line of code....
Code: [Select]
(defun c:bm (/ pt1 pt2 pt3)
  (setq pt1 (getpoint "\nPick First Beam Point:")
        pt2 (getpoint pt1 "\nPick Second Beam Point:")
  )
  (command "layer" "make" "S-BEAM" "color" 5 "" "")
  ;;(command "clayer" "s-beam") NOT needed because the 'layer' 'make'
  ;;  sets the layer current
  (entmake (list '(0 . "LINE")
                 (cons 10 (polar pt1 (angle pt1 pt2) 3))
                 (cons 11 (polar pt2 (angle pt2 pt1) 3))

           )
  )
  (command "layer" "make" "S-BM-TEXT" "color" 1 "" "")
  ;;(command "clayer" "S-BM-TEXT") NOT needed because the 'layer' 'make'
  ;;  sets the layer current
  ;; correction of error in next line, thanks CADaver!!
  ;;(setq pt3 (polar pt2 (angle pt1 pt2) (/ (distance pt1 pt2) 2)))
  (setq pt3 (polar pt1 (angle pt1 pt2) (/ (distance pt1 pt2) 2)))
  (setq useros (getvar "osmode"))
  (setvar "osmode" 0)
  (command "-insert" "BM-TEXT" pt3 "" ""(* 180.0 (/ (angle pt1 pt2) pi)))
  (setvar "osmode" useros)
  (princ)
) ;end defun  
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.

CADaver

  • Guest
line with attribute tool
« Reply #37 on: December 10, 2004, 02:41:35 PM »
Code: [Select]
(setq pt3 (polar pt2 (angle pt1 pt2) (/ (distance pt1 pt2) 2)))

Correct me if I'm wrong here, but if you start the polar function from PT2 and pull the angle between PT1 and PT2, you're not going to be at the midpt between PT1 and PT2, but rather that far OFF the end pf PT2.  Right???

Shouldn't it be:
Code: [Select]
(setq pt3 (polar pt1 (angle pt1 pt2) (/ (distance pt1 pt2) 2)))

or:
Code: [Select]
(setq pt3 (polar pt2 (angle pt2 pt1) (/ (distance pt1 pt2) 2)))

Be nice, remember I'm a lisp hack.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
line with attribute tool
« Reply #38 on: December 10, 2004, 02:50:44 PM »
You are absolutely right.
Typo on my part & I never ran the code. :shock:
See those old eyes are still sharp. :D
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.

CADaver

  • Guest
line with attribute tool
« Reply #39 on: December 10, 2004, 04:17:20 PM »
Well you told me read each line...

whew, I was scared there for a minute, I'm at that age where "old-timer's" disease is a real worry.    :horror:   :wink:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
line with attribute tool
« Reply #40 on: December 10, 2004, 05:43:42 PM »
If you try to keep up with ACAD you won't have to worry about exercising those
brain cells. Seems like just that is a full time job. I always feel that way
when I get overrun with work. Oh well working through the weekend again. At least
I'm not alone, right t-bear. :D

Have a good weekend.
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.

CADaver

  • Guest
line with attribute tool
« Reply #41 on: December 10, 2004, 05:54:38 PM »
Quote from: CAB
If you try to keep up with ACAD you won't have to worry about exercising those brain cells.
had I known I was gonna need 'em this long, I'd have been kinder to 'em in my youth.
Quote from: CAB
Oh well working through the weekend again. At least I'm not alone, right t-bear. :D


I'll be here, too.

dubb

  • Swamp Rat
  • Posts: 1105
line with attribute tool
« Reply #42 on: December 13, 2004, 03:24:44 PM »
finally i got it works perfect. thank you fellaz for all your help. thank you thank you.