Looking for procedure to build new command

Looking for procedure to build new command

townest
Advocate Advocate
1,012 Views
4 Replies
Message 1 of 5

Looking for procedure to build new command

townest
Advocate
Advocate

I'm looking for procedure to build a new command.  

 

Specs:

Base command: Boundary

New Name: Tbound (not critical)

Functionality:  Fires 'Boundary' command; sets layer to 'bound1'; sets linetype to bylayer; sets color to bylayer; sets lineweight to bylayer; unchecks island detection; sets object type to polyline; sets boundary set to current viewpoint; upon exit reverts back to previous current layer and settings.

 

Let me know if you can help.

 

Thank you.

 

Tyler  

0 Likes
1,013 Views
4 Replies
Replies (4)
Message 2 of 5

Shneuph
Collaborator
Collaborator

Would you like fries with that?

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes
Message 3 of 5

pbejse
Mentor
Mentor

@townest wrote:

I'm looking for procedure to build a new command.  


 

sets linetype to bylayer; sets color to bylayer

-setvar [ CECOLOR CELTYPE CELWEIGHT ]

Fires 'Boundary' command,  unchecks island detection; sets object type to polyline; sets boundary set to
-BOUNDARY (Command)
Object Type

sets layer to 'bound1
-entlast Detect last entity created, assign to variable
-entmod to change layer

 

add 5cents and you can upsize your fries

 

HTH

 

0 Likes
Message 4 of 5

ВeekeeCZ
Consultant
Consultant

Well, since the reliability of the BOUNDARY/HATCH command is as it is, especially in heavy drawings, I would suggest you to remember well all the variables it's changing. Because one day you might find yourself resetting them manually.

 

(defun c:Tbound (/ *error* lay col clt clw hpb idm)

  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if lay (setvar 'clayer lay))
    (if col (setvar 'cecolor col))
    (if clt (setvar 'celtype clt))
    (if clw (setvar 'celweight clw))
    (if hpb (setvar 'hpbound hpb))
    (if idm (setvar 'hpislanddetectionmode idm))
    (princ)
    )

  ; --------------------------------------------------------------------------------------------------
  
  (setq lay (getvar 'clayer))			(command "_.LAYER" "_T" "bound1" "_M" "bound1" "")
  (setq col (getvar 'cecolor))			(setvar 'cecolor "BYLAYER")
  (setq clt (getvar 'celtype))			(setvar 'celtype "BYLAYER")
  (setq clw (getvar 'celweight))		(setvar 'celweight -1)
  (setq hpb (getvar 'hpbound))			(setvar 'hpbound 1)
  (setq idm (getvar 'hpislanddetectionmode))	(setvar 'hpislanddetectionmode 0)

  (command-s "_.-BOUNDARY")

  (*error* "end")
  )

 

 

0 Likes
Message 5 of 5

townest
Advocate
Advocate

Thank you.  I'll study this and give it a go.
Tyler

0 Likes