Author Topic: little help with pointsin.lsp  (Read 4584 times)

0 Members and 1 Guest are viewing this topic.

pedroantonio

  • Guest
little help with pointsin.lsp
« on: March 02, 2014, 03:58:21 AM »
I found this lisp for insert points into autocad.I change only the layer names. (attach file)

I want  to do a change in this code but i dont know how .. I want to add this two lines
Code - Auto/Visual Lisp: [Select]
  1. (setq scl (getvar "useri1"))
  2. (setq ht(* 0.0025 scl))

scl = scale  ,ht = text height
This two lines call a general lisp that change the size of all insert block in the drawing.
Sorry for my bad english. Please help ... Thanks
« Last Edit: March 07, 2014, 10:15:04 AM by Topographer »

DEVITG

  • Bull Frog
  • Posts: 481
Re: little help with pointsin.lsp
« Reply #1 on: March 02, 2014, 08:15:59 PM »
Pedro , me atrevo escribirte en castellano , que me imagino que es tu idioma nativo.

¿Donde quieres agregar las líneas ?

Para leer la variable  USERI1 , primero debes asignarle un valor

(setvar 'USERI1   45)

USERI1 a USERI5 admite enteros 23 , 567  890  etc y tiene la ventaja de que se guarda en el DWG

si quieres puedes conectarte a mi correo,  es mi nombre de usuario en gmail
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

pedroantonio

  • Guest
Re: little help with pointsin.lsp
« Reply #2 on: March 03, 2014, 02:34:39 AM »
Hello Devitg.Please write in english because i canot understand you !!!!!
this is the user1 lisp  i use for all my lisp
Code - Auto/Visual Lisp: [Select]
  1. ( DEFUN C:SETSC ()
  2.     (SETQ CURSC (getvar "useri1" ))
  3.     (princ "scale 1:")(princ cursc)
  4.     (setq newsc (getint "\nNew scale  1:"))
  5.     (setvar "useri1" newsc)
  6.       (setq a1 (getvar "useri1"))
  7.      (setvar "ltscale" (* a1 0.005))
  8.     (princ "\nThe drawing scale is 1:")(princ newsc)(princ)
  9. )

Then i add to all lisp i use  this code lines

Code - Auto/Visual Lisp: [Select]
  1. (setq scl (getvar "useri1"))
  2. (setq ht(* 0.0025 scl))

But in pointsin.lsp code i am confused. Can you help me ?

Thank you ..
« Last Edit: March 07, 2014, 10:14:50 AM by Topographer »

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: little help with pointsin.lsp
« Reply #3 on: March 03, 2014, 04:20:38 AM »
First, the useri# sysvar only stores integers, not fractions. You might want to change that to userr1 instead so you can have scales of non integer values.

Second, if you want the text height adjusted for the scale ... then reading that LSP file it seems it uses DimScale x DimText to calculate the height. So either set a special DimStyle as current with the text height as you want it, or search through that list to use your calculation instead of where it uses getvar to get these 2 variables.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

pedroantonio

  • Guest
Re: little help with pointsin.lsp
« Reply #4 on: March 05, 2014, 10:21:03 AM »
if i understand all the problem is only is this lines ?

Code - Auto/Visual Lisp: [Select]
  1.    PI:INSERTPOINTBLOCKS
  2.    (POINTSLIST POINTFORMAT / AROLD POINTBLOCKLAYERFORMAT)
  3.   (SETQ POINTBLOCKLAYERFORMAT (PI:GETBLOCKLAYERFORMAT POINTFORMAT))
  4.   (COMMAND "._undo" "_group")
  5.   (SETQ AROLD (GETVAR "attreq"))
  6.   (SETVAR "attreq" 0)
  7.   ;;Insert a Softdesk style block
  8.      ;; The format of pointlist is defined in GETPOINTSLIST
  9.      POINTLIST POINTSLIST
  10.     (PI:INSERTPOINTBLOCK
  11.       POINTLIST
  12.       POINTFORMAT
  13.       POINTBLOCKLAYERFORMAT
  14.     )
  15.   )
  16.   (SETVAR "attreq" AROLD)
  17.   (COMMAND "._undo" "_end")
  18. )
  19.  
  20.    PI:INSERTPOINTBLOCK (POINTLIST POINTFORMAT POINTBLOCKLAYERFORMAT / AT
  21.                         AV EL EN ET N
  22.                        )
  23.   (PI:MAKELAYER POINTBLOCKLAYERFORMAT POINTLIST POINTFORMAT)
  24.     "._insert"
  25.     "point"
  26.     ;; Chop off the z coordinate for 2D block insertion as advertised.
  27.     (REVERSE (CDR (REVERSE (CAR POINTLIST))))
  28.     (* (GETVAR "dimscale") (GETVAR "dimtxt"))
  29.     ""
  30.     0
  31.   )
  32.   (SETQ EN (ENTLAST))

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: little help with pointsin.lsp
« Reply #5 on: March 06, 2014, 12:27:49 AM »
Yes, that (* (getvar "dimscale") (getvar "dimtext")) gets those sysvars, multiplies them together and then passes the reult back to the surrounding form. In this case the command call at the position where it expects the block's scale factor.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

pedroantonio

  • Guest
Re: little help with pointsin.lsp
« Reply #6 on: March 06, 2014, 02:58:23 AM »
i change the code to this
Code - Auto/Visual Lisp: [Select]
  1.    PI:INSERTPOINTBLOCKS
  2.    (POINTSLIST POINTFORMAT / AROLD POINTBLOCKLAYERFORMAT)
  3.   (SETQ POINTBLOCKLAYERFORMAT (PI:GETBLOCKLAYERFORMAT POINTFORMAT))
  4.   (COMMAND "._undo" "_group")
  5.   (SETQ AROLD (GETVAR "attdia"))
  6.   (SETVAR "attdia" 0)
  7.   ;;Insert a Softdesk style block
  8.      ;; The format of pointlist is defined in GETPOINTSLIST
  9.      POINTLIST POINTSLIST
  10.     (PI:INSERTPOINTBLOCK
  11.       POINTLIST
  12.       POINTFORMAT
  13.       POINTBLOCKLAYERFORMAT
  14.     )
  15.   )
  16.   (SETQ SCL (GETVAR "useri1"))
  17.   (SETQ SCL1 (* SCL 0.0025))
  18.   (SETVAR "attdia" 1)
  19.   (COMMAND "._undo" "_end")
  20. )
  21.  
  22.    PI:INSERTPOINTBLOCK (POINTLIST POINTFORMAT POINTBLOCKLAYERFORMAT / AT
  23.                         AV EL EN ET N DT1 SCL1 SCL1
  24.                        )
  25.   (PI:MAKELAYER POINTBLOCKLAYERFORMAT POINTLIST POINTFORMAT)
  26.   (COMMAND "._insert" "point" DT1 SCL1 SCL1 "0")
  27.   (SETVAR "attdia" 0)
  28. )
  29. (SETQ EN (ENTLAST))

But i have this error

Trapped error: no function definition: PI:GETDNPATH*Cancel*

I dont know  :embarrassed:

pedroantonio

  • Guest
Re: little help with pointsin.lsp
« Reply #7 on: March 07, 2014, 10:12:50 AM »
Any ideas ?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: little help with pointsin.lsp
« Reply #8 on: March 07, 2014, 05:06:23 PM »
« Last Edit: March 07, 2014, 05:19:23 PM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: little help with pointsin.lsp
« Reply #9 on: March 07, 2014, 05:13:36 PM »
Hi Kerry this is a dead link !!!

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: little help with pointsin.lsp
« Reply #10 on: March 07, 2014, 05:20:36 PM »
The closing parenthesis should be in the link.

Fixed.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: little help with pointsin.lsp
« Reply #11 on: March 07, 2014, 05:35:36 PM »
Kerry is using exactly the same code that I am trying to change
(* (GETVAR "dimscale") (GETVAR "dimtxt"))
This link does not help at all.
Can you help?

Thanks

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: little help with pointsin.lsp
« Reply #12 on: March 07, 2014, 05:44:00 PM »
What do you want to change.
What do you want it to change to.


Only post the relevant code.

Consider this an exercise in asking the right question.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: little help with pointsin.lsp
« Reply #13 on: March 07, 2014, 05:57:46 PM »
in *.mnl file i have ths lisp

Code - Auto/Visual Lisp: [Select]
  1. ( DEFUN C:SETSC ()
  2.     (SETQ CURSC (getvar "useri1" ))
  3.     (princ "scale 1:")(princ cursc)
  4.     (setq newsc (getint "\nNew scale  1:"))
  5.     (setvar "useri1" newsc)
  6.       (setq a1 (getvar "useri1"))
  7.      (setvar "ltscale" (* a1 0.005))
  8.     (princ "\nThe drawing scale is 1:")(princ newsc)(princ)
  9. )

for  giving the correct scale to my blocks,texts, everything

I change all the lisp roots i need to work with this lisp

for example i add this lines to the code
Code - Auto/Visual Lisp: [Select]
  1. (setq scl (getvar "useri1"))
  2. (setq ht(* 0.0025 scl))

I try to do the same thing with the pointsin.lsp  (I attach it in the beginning)

In my opinion, the problem focuses on these lines of code

Code - Auto/Visual Lisp: [Select]
  1.    PI:INSERTPOINTBLOCKS
  2.    (POINTSLIST POINTFORMAT / AROLD POINTBLOCKLAYERFORMAT)
  3.   (SETQ POINTBLOCKLAYERFORMAT (PI:GETBLOCKLAYERFORMAT POINTFORMAT))
  4.   (COMMAND "._undo" "_group")
  5.   (SETQ AROLD (GETVAR "attreq"))
  6.   (SETVAR "attreq" 0)
  7.   ;;Insert a Softdesk style block
  8.      ;; The format of pointlist is defined in GETPOINTSLIST
  9.      POINTLIST POINTSLIST
  10.     (PI:INSERTPOINTBLOCK
  11.       POINTLIST
  12.       POINTFORMAT
  13.       POINTBLOCKLAYERFORMAT
  14.     )
  15.   )
  16.   (SETVAR "attreq" AROLD)
  17.   (COMMAND "._undo" "_end")
  18. )
  19.  
  20.    PI:INSERTPOINTBLOCK (POINTLIST POINTFORMAT POINTBLOCKLAYERFORMAT / AT
  21.                         AV EL EN ET N
  22.                        )
  23.   (PI:MAKELAYER POINTBLOCKLAYERFORMAT POINTLIST POINTFORMAT)
  24.     "._insert"
  25.     "point"
  26.     ;; Chop off the z coordinate for 2D block insertion as advertised.
  27.     (REVERSE (CDR (REVERSE (CAR POINTLIST))))
  28.     (* (GETVAR "dimscale") (GETVAR "dimtxt"))
  29.     ""
  30.     0
  31.   )
  32.   (SETQ EN (ENTLAST))

I tried to change the code and I did these changes

Code - Auto/Visual Lisp: [Select]
  1.    PI:INSERTPOINTBLOCKS
  2.    (POINTSLIST POINTFORMAT / AROLD POINTBLOCKLAYERFORMAT)
  3.   (SETQ POINTBLOCKLAYERFORMAT (PI:GETBLOCKLAYERFORMAT POINTFORMAT))
  4.   (COMMAND "._undo" "_group")
  5.   (SETQ AROLD (GETVAR "attdia"))
  6.   (SETVAR "attdia" 0)
  7.   ;;Insert a Softdesk style block
  8.      ;; The format of pointlist is defined in GETPOINTSLIST
  9.      POINTLIST POINTSLIST
  10.     (PI:INSERTPOINTBLOCK
  11.       POINTLIST
  12.       POINTFORMAT
  13.       POINTBLOCKLAYERFORMAT
  14.     )
  15.   )
  16.   (SETQ SCL (GETVAR "useri1"))
  17.   (SETQ SCL1 (* SCL 0.0025))
  18.   (SETVAR "attdia" 1)
  19.   (COMMAND "._undo" "_end")
  20. )
  21.  
  22.    PI:INSERTPOINTBLOCK (POINTLIST POINTFORMAT POINTBLOCKLAYERFORMAT / AT
  23.                         AV EL EN ET N DT1 SCL1 SCL1
  24.                        )
  25.   (PI:MAKELAYER POINTBLOCKLAYERFORMAT POINTLIST POINTFORMAT)
  26.   (COMMAND "._insert" "point" DT1 SCL1 SCL1 "0")
  27.   (SETVAR "attdia" 0)
  28. )
  29. (SETQ EN (ENTLAST))

But i have this error

Trapped error: no function definition: PI:GETDNPATH*Cancel*

Can you help me ?

Thank you

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: little help with pointsin.lsp
« Reply #14 on: March 07, 2014, 06:02:53 PM »

I have posted a link to that function, which you indicated was exactly the code you had
Find  WIKI-AI:GETDNPATH at the link I posted.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: little help with pointsin.lsp
« Reply #15 on: March 07, 2014, 06:08:55 PM »
In your modified code you are calling PI:INSERTPOINTBLOCK, passing value SCL1

SCL1 is defined after you call  PI:INSERTPOINTBLOCK ; it should be defined before, otherwise wou will pass nil as a parameter value.

No wait,
SCL1 is a global variable defined after you are using it.
« Last Edit: March 07, 2014, 06:17:47 PM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

pedroantonio

  • Guest
Re: little help with pointsin.lsp
« Reply #16 on: March 08, 2014, 11:00:25 AM »
i am confused !!! :embarrassed:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: little help with pointsin.lsp
« Reply #17 on: March 08, 2014, 11:14:12 AM »
You woke me up at 2:00 am on Sunday morning to tell me that ??
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: little help with pointsin.lsp
« Reply #18 on: March 08, 2014, 11:17:35 AM »
<blink> What the ... When did you guys become an item?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst