Jump to content

Decimal points in compare points lisp


russ079

Recommended Posts

This should do it limited testing. tho i think the z shows up backwards.

 

-edit moved file to latest post.

Edited by mhupp
Link to comment
Share on other sites

Thanks. I have just tried it, but the x y z all come up as 00 and it asks me to manually enter the attributes. Could this be the setup of my autocad or the dwg file?

Capture.PNG

Link to comment
Share on other sites

Works for me.  but updated the code above to

 

  • Z is now shown in the right direction.
  • moved the insert command outside the setq.
  • added an error check to see if both points are picked.

 

Edited by mhupp
Link to comment
Share on other sites

What version are you using ? Is it autocad or BricsCad ?

 

From the command line it looks like the problem is when it is trying to insert the value to the block, it shows a command of just "2.6" and says unknown command.

Screenshot 2023-03-20 041446.png

Link to comment
Share on other sites

Might need an empty "" after the "0" to exit the insert command.

 

from
(command "-INSERT" blnam "_S" cmp:scal ptb "0" (rtos ...
to
(command "-INSERT" blnam "_S" cmp:scal ptb "0" "" (rtos ...

 

Link to comment
Share on other sites

Ive tried with ATTREQ set to 1 & 0, but neither works. Also tried added "" but still no luck. I dont understand why it works on your PC fine. Ive tried on 2 different autocads and neither work.

Link to comment
Share on other sites

What happens if you use this with scale hard set

 

(command "-INSERT" blnam "_S" 5 ptb "0" (rtos (abs (* (car  deval) 1.0)) 2 1) (rtos (abs (* (cadr  deval) 1.0)) 2 1) (rtos (* (caddr deval) -1.0) 2 1))

 That would suggest something wrong with cmp:scal I redid the IF as the 5 is hard coded any way.

(setq *cmp:scal 5)
(setq cmp:scal (getreal (strcat "\nSpecify tags scale < 5 >: ")))
(if (= cmp:scal nil)
(setq cmp:scal *cmp:scal)
)

This may affect further into code for me your welcome to use my Multi radio buttons. Can preset which is most commonly used and set it to last picked when ran again.

Multiradio18.png.9cd9acae68302cda3539bb0b2a4eb337.png

 

 

Edited by BIGAL
Link to comment
Share on other sites

Quote

(command "-INSERT" blnam "_S" 5 ptb "0" (rtos (abs (* (car deval) 1.0)) 2 1) (rtos (abs (* (cadr deval) 1.0)) 2 1) (rtos (* (caddr deval) -1.0) 2 1))

I tried replacing the above line but still no look. My drawings are scale 1:1 - 1 unit = 1mm

Link to comment
Share on other sites

9 hours ago, russ079 said:

ATTREQ 1 & 0'a ayarlıyken denedim ama ikisi de çalışmıyor. Ayrıca "" eklemeyi denedim ama yine de şans yok. PC'nizde neden iyi çalıştığını anlamıyorum. 2 farklı autocad denedim ve ikisi de işe yaramadı.

hello, it didn't work for me either

 

image.thumb.png.3602a49e50d99804279c20c76890bb3a.png

Edited by thecocuk07
Link to comment
Share on other sites

Are you on autocad 2020? Im not sure if its anything to do with version of autocad or windows, read before about a different lisp that would only work on x86 not 64bit but unsure why. Just seems odd how it works on mhupp pc fine, just not sure what the difference is.

Link to comment
Share on other sites

1 minute ago, russ079 said:

Are you on autocad 2020? Im not sure if its anything to do with version of autocad or windows, read before about a different lisp that would only work on x86 not 64bit but unsure why. Just seems odd how it works on mhupp pc fine, just not sure what the difference is.

yes  , autocad  2020  and  win 10 64bit 

Link to comment
Share on other sites

looked over the old list for the layers they had some other variables set so added those except for osmode. see if that works. if this doesn't work your going to have to type out the insert command and look at what AutoCAD wants.

 

this is what BricsCAD uses.

(command "-INSERT" blnam "_S" cmp:scal ptb "0" (rtos (abs (* (car deval) 1.0)) 2 1) (rtos (abs (* (cadr deval) 1.0)) 2 1) (rtos (* (caddr deval) -1.0) 2 1))

: -INSERT
? to list blocks in drawing/~ to open the file dialog/<Block to insert> <Compare_RT>: Compare_RT
Units: Unitless    Conversion: 1"
Insertion point for block or [Multiple blocks/Scale]:_S
Scale factor for block: 2
Insertion point for block or [Multiple blocks/Scale]:
Rotation angle for block <0>: 0

Delta x <00>: 8
Delta y <00>: 2
Delta z <00>: 2

 

Link to comment
Share on other sites

4 hours ago, mhupp said:

looked over the old list for the layers they had some other variables set so added those except for osmode. see if that works. if this doesn't work your going to have to type out the insert command and look at what AutoCAD wants.

 

this is what BricsCAD uses.

(command "-INSERT" blnam "_S" cmp:scal ptb "0" (rtos (abs (* (car deval) 1.0)) 2 1) (rtos (abs (* (cadr deval) 1.0)) 2 1) (rtos (* (caddr deval) -1.0) 2 1))

: -INSERT
? to list blocks in drawing/~ to open the file dialog/<Block to insert> <Compare_RT>: Compare_RT
Units: Unitless    Conversion: 1"
Insertion point for block or [Multiple blocks/Scale]:_S
Scale factor for block: 2
Insertion point for block or [Multiple blocks/Scale]:
Rotation angle for block <0>: 0

Delta x <00>: 8
Delta y <00>: 2
Delta z <00>: 2

 

Thank you for your efforts and interest.

  • Like 1
Link to comment
Share on other sites

Repeated operations to remember the scale factor; i did something like this but i guess it's wrong

 

  (if (= *cmp:scal nil) (setq *cmp:scal 5)) ;set your most used scale here.
   (initget 2)
  (setq cmp:scal (getreal (strcat "\nSpecify tags scale <" (rtos *cmp:scal) ">: "))
(if (= cmp:scal nil)(setq cmp:scal *cmp:scal))
    (progn)
    (setq *cmp:scal cmp:scal)
  )  

 

Link to comment
Share on other sites

I have just tried on another drawing, it is working good. Only small issue is after comfirming tag scale, my point style changes and goes small on the screen. After the lisp it complete it goes back to my set point style of 25 units. Is there anyway the tag scale can be set without affecting the point style settings ?

Link to comment
Share on other sites

I have figured out how to stop the point size changing. It was set to change the pdsize to 0.15, so updated to 25 and all good now.

 

  ) 
(setq vars '(cmdecho attdia attreq pdsize INSUNITS)  ;list of variables
        vals  (mapcar 'getvar vars)                     ;store old values
  )
  (mapcar 'setvar vars '(0 0 1 0.15 0))                 ;set new values

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...