how to make this ucs independent?

Discussion in 'AutoCAD' started by Mark Propst, Dec 23, 2003.

  1. Mark Propst

    Mark Propst Guest

    Here's a simplified snip from a little utility function
    ;pick a block
    ;pick a line
    ;divide line with blocks
    ;basically the divide command without having to know the block name
    (defun c:db ( / blk blkname method lin1 which title def ext flags ptinview
    lastent entlist)
    (setq blk (car(entsel "\npick a block")))
    (setq blkname (getblkname blk));custom func - you get the idea
    (setq lin1 (car(entsel (strcat "\npick a line to divide with "
    blkname))))
    (setq db:num (g:int "\nenter number of divisions" db:num));custom func -
    getint with default
    (command "divide" lin1 "b" blkname "y" db:num)
    )

    since i'm being lazy and using command, instead of calcing points i thought
    it would work in non-world ucs but , no!
    do I have to do it the hard way and calculate points and then try to figure
    out that trans business finally???

    tia
    Mark
     
    Mark Propst, Dec 23, 2003
    #1
  2. Hi Mark,

    Try this, it worked for me, if you tell us wich is the error, it would be
    usefull.

    (defun c:db (/ blk blkname lin1)
    (if (not db:num)
    (setq db:num 10)
    )
    (setq blk (car (entsel "\n Pick a block")))
    (setq blkname (cdr(assoc 2 (entget blk))))
    (setq
    lin1 (car (entsel (strcat "\n Pick a line to divide with block "
    blkname
    )
    )
    )
    )
    (setq db:num (getint (strcat "\n Enter number of divisions: <"
    (itoa db:num)
    ">"
    )
    )
    )
    (command "divide" lin1 "b" blkname "y" db:num)
    (princ)
    )

    Saludos

    Marco Jacinto
     
    Marco Jacinto, Dec 23, 2003
    #2
  3. Mark Propst

    NParcon Guest

    Why calculate points and transpose?
    Using the segments option, the divide
    command creates the points. Just
    extract the DXF 10 and DXF 210 for
    your block insertion point and rotation
    if required.
     
    NParcon, Dec 23, 2003
    #3
  4. Mark Propst

    zeha Guest

    ;;why did it not working in non ucs??
    (defun c:db ( / blk blkname method lin1 which title def ext flags ptinview lastent entlist)
    (if (and (setq blk (car (entsel "\npick a block")))(= (cdr (assoc 0 (setq elist (entget blk)))) "INSERT"))
    (progn
    (setq blkname (cdr (assoc 2 elist));custom func - you get the idea
    lin1 (car (entsel (strcat "\npick a line to divide with <" blkname "> ")))
    )
    (if (and lin1 (wcmatch (cdr (assoc 0 (entget lin1))) "LINE,*POLYLINE"))
    (progn
    (initget 6)
    (setq df:num (if (and (= (type db:num) 'INT)(> db:num 1)) db:num 3)
    db:num (getint (strcat "\nenter number of divisions <"(itoa df:num)"> "));custom func - getint with default
    db:num (if (and db:num (> db:num 1))(setq df:num db:num) df:num)
    )
    (command "._divide" lin1 "b" blkname "y" db:num)
    )
    (alert "Not a line or a (LW)Polyline")
    )
    )
    (alert "Is not a block")
    )
    (princ)
    )
     
    zeha, Jan 5, 2004
    #4
  5. Mark Propst

    Mark Propst Guest

    well, like my version, your version doesn't *always* put the blocks *on* the
    line
    I will post a zipped dwg in customer files under subject "Divide test" if
    you want to check it.
    Thanks for your efforts.
    Mark
     
    Mark Propst, Jan 5, 2004
    #5
  6. Mark Propst

    zeha Guest

    The zipfile was to large

    if you use getpoint or equal command to get a point in UCS
    you can it transform by the command trans
     
    zeha, Jan 5, 2004
    #6
  7. Mark Propst

    Mark Propst Guest

    5kb?

    I'll have to play with trans when I get time
    Thanks again
    Mark
     
    Mark Propst, Jan 5, 2004
    #7
  8. Mark Propst

    Mark Propst Guest

    in these routines we weren't using getpoint or equal.
    But now I see that even the autocad command "Divide" doesn't work in a non
    world ucs either so that's why this simple function that calls the command
    also doesn't work.
    I hadn't checked that before.
    Guess I have to rewrite the "Divide" command instead of trying the sleazy
    easy way of "command"

    Thanks again
    Mark
     
    Mark Propst, Jan 5, 2004
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.