Results 1 to 4 of 4

Thread: Need some help with code.....

  1. #1
    Member
    Join Date
    2010-10
    Posts
    2
    Login to Give a bone
    0

    Post Need some help with code.....

    I have been trying to get code to run for sometime now. It is missing 1 are 2 items. I am hoping that it will be better and easier than Autocad's "ALIGN". This is mostly for 3D purposes where an item can be moved parallel to another until it is perpendicular to it then rotate it so that the 2 are lined up.


    [CODE:]

    ;;Moves and object in a parallel plane of another until it is perpendicular
    ;;to it then rotates 1st object so that it lines up with it. Similar to
    ;;align command.
    ;;Written by Laison Albarado 11-09-2011
    (defun c:rm (/ pt1 pt2 pt3 pt4 pt0 ang1 dst1)
    (setq os (getvar "OSMODE"))
    (setvar "OSMODE" (logior os 1 2 4 32 128 8192))
    (setq pt1 (getpoint "\nSelect 1st object: "))
    (setq pt2 (getpoint pt1 "\nEnter second point: "))
    (setq pt1 (getdistance "\nEnter Distance are select item: "))
    (setvar "OSMODE" (logior os 1 2 4 32 128 8192))
    (Setq pt3 (getpoint pt1 "\nSelect Reference point/object: "))
    (command
    "move" pt1 pt2
    (setq ang1 (getangle pt1 pt3))
    (setq pt4 (polar pt2 ang1 dst1))
    (command
    "rotate" pt1 pt3
    (setvar "osmode" os)
    )
    )
    )

  2. #2
    Member
    Join Date
    2008-11
    Posts
    28
    Login to Give a bone
    0

    Default Re: Need some help with code.....

    Just want to make sure..do you know of Autocad's "3dalign" command?
    and if you do, what about it are you trying to enhance?

  3. #3
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Need some help with code.....

    Some corrections for your codes .

    You can't get object by the function "getpoint"
    Code:
    (setq pt1 (getpoint "\nSelect 1st object: ")) 
    (setq pt2 (getpoint pt1 "\nEnter second point: "))
    So it should be Like ....
    Code:
    (setq pt1 (car (entsel "\nSelect 1st object: ")))
    or with ssget function
    Code:
    (setq pt1 (ssget ))
    And for getting the distance between two points, and the variable name should not be same as the one that you used getting the first point ..(pt1)

    Code:
    (setq Dis1 (getdistance "\nEnter Distance are select item: "))
    So it should be Like ....
    Code:
    (setq Dis1 (getdist "\nEnter Distance are select item: "))
    And also I do know about the use of your osmode , may be someone else would check it out .

    Good luck

    Tharwat

  4. #4
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Need some help with code.....

    Could you please bring an example which shows your needs and steps of the routine ?

    Thanks

    Tharwat

Similar Threads

  1. Allow Other Code Compilers for ARX Code
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2013-02-10, 08:06 AM
  2. Insert vbscript code has not code
    By buzz in forum AMEP General
    Replies: 3
    Last Post: 2008-02-09, 03:08 AM
  3. Please help on this code
    By jitesh789 in forum AutoLISP
    Replies: 6
    Last Post: 2007-12-11, 05:55 PM
  4. Convert VBA code to VB code
    By Robert Platt in forum VBA/COM Interop
    Replies: 20
    Last Post: 2007-08-15, 10:13 PM

Posting Permissions

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