Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Command for box

  1. #1
    Member
    Join Date
    2007-10
    Posts
    8
    Login to Give a bone
    0

    Default Command for box

    Hi,

    I'm trying to use the command function to insert a box. If I want a box with sides parallel to the coordinate system axis X and Y, I can use the following expression without any problems:

    (command "_.box"
    "c" '(0 0) ;center
    "l" 4 ;length
    5 ;width
    2 ;height
    )

    Unfortunately, all my efforts to write a command expression that creates a box that is _not_ aligned with the axis X and Y failed, although it is trivial to do that using point and click.

    Please, what is the trick?

    Thanks in advance,

    António Leitão.

  2. #2
    AUGI Addict Mr Cory's Avatar
    Join Date
    2007-01
    Location
    Under a Rock over there
    Posts
    1,006
    Login to Give a bone
    0

    Default Re: Command for box

    Try this;

    Code:
     
    (defun c:bx ()
    (command "_.box" "c" "0,0,0" "l" "4" "5" "2")
    (princ))

  3. #3
    Member
    Join Date
    2007-10
    Posts
    8
    Login to Give a bone
    0

    Default Re: Command for box

    Quote Originally Posted by Mr Cory View Post
    Try this;

    Code:
     
    (defun c:bx ()
    (command "_.box" "c" "0,0,0" "l" "4" "5" "2")
    (princ))
    Your suggestion is no different than mine. It still can't create a box that is _not_ aligned with the axis. Or I'm I misunderstanding your solution?

    Best regards,

    António Leitão.

  4. #4
    AUGI Addict
    Join Date
    2005-07
    Posts
    2,356
    Login to Give a bone
    0

    Default Re: Command for box

    Quote Originally Posted by aml View Post
    Your suggestion is no different than mine. It still can't create a box that is _not_ aligned with the axis. Or I'm I misunderstanding your solution?

    Best regards,

    António Leitão.
    Can you not just add a rotate or align previous command to the end?

  5. #5
    I could stop if I wanted to
    Join Date
    2007-05
    Location
    Brookfield WI
    Posts
    331
    Login to Give a bone
    0

    Default Re: Command for box

    Quote Originally Posted by Steve.Sanderson(UK) View Post
    Can you not just add a rotate or align previous command to the end?

    not sure how align works in 3D but I suppose you could could use entlast so that the box you created is selected automatically

    Code:
    (defun c:bx ()
    (command "_.box" "c" "0,0,0" "l" "4" "5" "2")
    (princ)
    
      (setq ent (entlast))
      (command "_.align" ent"")
      )
    when done you need to pick the points to align the box?

  6. #6
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,105
    Login to Give a bone
    0

    Default Re: Command for box

    Maybe this will help.

    Code:
    (defun c:bx (/ BoxHeight BoxLength BoxWidth Rotation StartPoint)
      (setq	StartPoint (getpoint "\nSpecify center of box: ")
    	BoxLength  (getdist StartPoint "\nSpecify box length: ")
    	BoxWidth   (getdist StartPoint "\nSpecify box width: ")
    	BoxHeight  (getdist StartPoint "\nSpecify box height: ")
    	Rotation   (getangle StartPoint "\nSpecify rotation angle: ")
      )
      (command "_.box" "C" StartPoint "L" BoxLength	BoxWidth BoxHeight)
      (command "_.rotate"
    	   (entlast)
    	   ""
    	   "non"
    	   Startpoint
    	   (angtos Rotation)
      )
    )
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  7. #7
    AUGI Addict Mr Cory's Avatar
    Join Date
    2007-01
    Location
    Under a Rock over there
    Posts
    1,006
    Login to Give a bone
    0

    Default Re: Command for box

    Sorry misread the OP

  8. #8
    Member
    Join Date
    2007-10
    Posts
    8
    Login to Give a bone
    0

    Default Re: Command for box

    Quote Originally Posted by Opie View Post
    Maybe this will help.

    Code:
    (defun c:bx (/ BoxHeight BoxLength BoxWidth Rotation StartPoint)
      (setq	StartPoint (getpoint "\nSpecify center of box: ")
    	BoxLength  (getdist StartPoint "\nSpecify box length: ")
    	BoxWidth   (getdist StartPoint "\nSpecify box width: ")
    	BoxHeight  (getdist StartPoint "\nSpecify box height: ")
    	Rotation   (getangle StartPoint "\nSpecify rotation angle: ")
      )
      (command "_.box" "C" StartPoint "L" BoxLength	BoxWidth BoxHeight)
      (command "_.rotate"
    	   (entlast)
    	   ""
    	   "non"
    	   Startpoint
    	   (angtos Rotation)
      )
    )
    That seems to solve the problem. Thanks a lot!

    Best regards,

    António Leitão.


    PS: It is strange that the command form can't provide the appropriate arguments to simulate something that can be done directly using the box command.

  9. #9
    I could stop if I wanted to
    Join Date
    2007-05
    Location
    Brookfield WI
    Posts
    331
    Login to Give a bone
    0

    Default Re: Command for box

    Quote Originally Posted by Opie View Post
    Maybe this will help.

    Code:
    (defun c:bx (/ BoxHeight BoxLength BoxWidth Rotation StartPoint)
      (setq	StartPoint (getpoint "\nSpecify center of box: ")
    	BoxLength  (getdist StartPoint "\nSpecify box length: ")
    	BoxWidth   (getdist StartPoint "\nSpecify box width: ")
    	BoxHeight  (getdist StartPoint "\nSpecify box height: ")
    	Rotation   (getangle StartPoint "\nSpecify rotation angle: ")
      )
      (command "_.box" "C" StartPoint "L" BoxLength	BoxWidth BoxHeight)
      (command "_.rotate"
    	   (entlast)
    	   ""
    	   "non"
    	   Startpoint
    	   (angtos Rotation)
      )
    )
    what does this mean?
    Code:
      ""
    	   "non"
    	   Startpoint
    	   (angtos Rotation)
      )
    )

  10. #10
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Command for box

    Use the None OSnap override, provide the point, convert the angle from radians into whatever angular units are in use.

    However, the (angtos) will result in bugs, due to unit precision. Far better would be to mathmatically convert the units, e.g.:

    (/ (* rotation 180.0) pi)
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 6
    Last Post: 2018-07-20, 07:28 PM
  2. Replies: 6
    Last Post: 2007-04-23, 01:40 AM
  3. Replies: 4
    Last Post: 2006-05-09, 08:57 PM
  4. Replies: 8
    Last Post: 2005-06-30, 02:32 PM
  5. setting for command line word wrap (esp. DIST command)
    By lcamara in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2005-02-23, 08:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •