Results 1 to 9 of 9

Thread: Help with my code

  1. #1
    Login to Give a bone
    0

    Unhappy Help with my code

    Thanks in advance for anyone who can help with this one.
    I wrote this code to draw and angle profile ( L Shape). The code work fine, but i can only insert it a 0,0. If i insert it on any other part of the screen it reacts strange. Please explain in detail what is going wrong with my code. I wan t to learn! I am using Autocad 2016 on a windows platform.

    Thanks All
    Attached Files Attached Files

  2. #2
    100 Club
    Join Date
    2011-08
    Location
    Vadodara, India
    Posts
    147
    Login to Give a bone
    0

    Default Re: Help with my code

    Hi
    Here I have attached my code.

    Code:

    (Defun C:A-PROFILE ()
    (command "._layer" "_M" "SECTION" "")
    (setq cmd1 (getvar"cmdecho" ))
    (setvar "osmode" 0)
    (Setq pt1 (getpoint "\nEnter the point: ")) ;Starting point;
    (setq W (getdist "\nEnter the Width: "))
    (setq H (getdist "\nEnter the Hieght: "))
    (setq T1 (getdist "\nEnter the Horizontal Thickness T1: "))
    (setq T2 (getdist "\nEnter the Vertical Thickness: T2"))
    (setq pt2 (polar pt1 0 w))
    (setq pt3 (polar pt1 (/ pi 2.0) h))
    (setq pt4 (polar pt2 (/ pi 2.0) t1))
    (setq pt5 (polar pt3 0 t2))
    (setq pt6 (polar pt5 (* 1.5 pi) (- h t1)))
    (command "line" pt1 pt3 pt5 pt6 pt4 pt2 pt1 "")
    (setvar "osmode" 16383)
    (princ)
    )

  3. #3
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: Help with my code

    Hola Javier Perez , me imagino hablas Español
    Cometes el error que TODOS los aprendices de LISP cometimos

    El problema al dibujar con la linea de COMANDOS (command), es que si las referencia-objetos ( osnap) tienen un valor distinto de 0 , el comando le hace caso a las osnap , luego debes ponerla a 0
    Es una buena costumbre dejar el dwg tal como estaba antes de comenzar el LISp , el modo OSNAP se controla con la variable de sistema OSMODE

    Luego se puede poner

    al principio

    Code:
    (setq osmode (getvar 'osmode))
    (setvar 'osmode 0)
    haces todo lo que quieres hacer

    Code:
    (setvar 'osmode osmode)
    El valor del osmode es una variable que se dice BITWISE , o peso de BIT o BITCODED , y es la suma de las potencia de 2 que corresponde a cada tipo de OSMODE que quieras

    esta son los valores para OSMODE

    ;;;0 NONe
    ;;;1 ENDpoint
    ;;;2 MIDpoint
    ;;;4 CENter
    ;;;8 NODe
    ;;;16 QUAdrant
    ;;;32 INTersection
    ;;;64 INSertion
    ;;;128 PERpendicular
    ;;;256 TANgent
    ;;;512 NEArest
    ;;;1024 QUIck
    ;;;2048 APParent Intersection
    ;;;4096 EXTension
    ;;;8192 PARallel
    ;; IF OSMODE VAL = 1+2+4 = 7 IT WILL DO END MID AND CENTComo sabrás , todo número entero se puede expresar como la suma de los cuadrados de 2 y para cada numero enter corresponde un única combinación de los cuadrados de 2

    Espero lo hayas entendido .
    Cualquier duda , pregunta a mi correo mi usuario-sin-numero en el correo g

    Saludos desde Argentina .

  4. #4
    Login to Give a bone
    0

    Default Re: Help with my code

    Muchas gracias por su ayuda.
    Saludos de Arizona USA

    - - - Updated - - -

    Thank You so very much for your help. The program works perfect.
    I will continue to study and learn.

  5. #5
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: Help with my code

    Esta es la imagen de primer libro LISp
    Attached Images Attached Images

  6. #6
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: Help with my code

    The way to go is write 1 bit of code for each shape and read a data file that matches the sizes 100x100A,100,100,6,6,3

    If you google look for "Als steel works" a great lisp library of common structural shapes.

    - - - Updated - - -

    The way to go is write a small bit of code for each shape and read a data file 100x100A,100,100,6,6,3 100 angle 6 mm thick 3 mm radius.

  7. #7
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: Help with my code

    Adjunto ejemplar del curso basico de lisp.
    Attached Files Attached Files

  8. #8
    100 Club
    Join Date
    2011-08
    Location
    Vadodara, India
    Posts
    147
    Login to Give a bone
    0

    Default Re: Help with my code

    The zip file is corrupted.

  9. #9
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: Help with my code

    Find attached
    Attached Files Attached Files

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. help on this code
    By jitesh789 in forum AutoLISP
    Replies: 2
    Last Post: 2008-01-02, 02:19 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
  •