Recent Posts

Pages: [1] 2 3 ... 10
1
AutoLISP (Vanilla / Visual) / Block LISP - issue with attributes
« Last post by like_citrus on Today at 04:09:36 AM »
This code by others, makes a block at a selected point.
The issue is that if I have an attribute, it disappears in model space. But you can see it when you edit the block.

Is there a way to change so that the block is equivalent to that made by the BLOCK command. In this instance I can see the attributes.
Initially I also had issues with the BLOCK command. I tried settings such as ATTSYNC and ATTDISP and others, and now the attributes show up with the BLOCK command. But not with the LISP below.


Code: [Select]
(defun c:CreateBlock (/ bkn eee i ndx nm ssst st)
(if (and (setq ssst (ssget)) (setq st (getpoint "\nPick Base Point: ")))
(progn (setq ndx 0)
(setq time (rtos (getvar "CDATE") 2 6)) ; Format YYYYMMDD.HHMMSS
(setq year (substr time 3 2)) ; Two digits instead of four
(setq month (substr time 5 2))
(setq day (substr time 7 2))
(setq hour (substr time 10 2)) ; Increment of 3 from day to account for "." character
(setq minutes (substr time 12 2))
(setq seconds (substr time 14 2))
(while (tblobjname "block" (setq nm (strcat "Block-" year month day hour minutes seconds))))
(entmake (list '(0 . "BLOCK")
'(100 . "AcDbEntity")
'(67 . 0)
'(8 . "0")
'(100 . "AcDbBlockReference")
(cons 2 nm)
(cons 10 st)
'(70 . 0)
       )
)
(repeat (sslength ssst)
(entmake (cdr (entget (ssname ssst ndx))))
(entdel (ssname ssst ndx))
(setq ndx (+ 1 ndx))
)
(entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0")))
(entmake (list (cons 0 "INSERT")
(cons 2 nm)
(cons 6 (getvar "CELTYPE"))
(cons 8 (getvar "CLAYER"))
(cons 66 0)
(cons 10 st)
(cons 41 1)
(cons 42 1)
(cons 43 1)
(cons 50 0)
(cons 71 0)
(cons 44 0)
(cons 45 0)
       )
)
)
)
(princ)
)
2
CAD Standards / default value for .GetXXX methods. Best practice?
« Last post by ingenieur3d on Today at 03:55:23 AM »
Hi!

What would be best practice for default values of command line .GetXXX methods? It appears that the native 'SETVAR' variables set the current value as default, and that is clean: the user that enters will stick to the current value, and also got a useful feedback. If one offers default values, is that to be always followed ? I haven't been able to confirm that this is *the* standard.

Would be curious for your experiences. Thank in advances!
3
Sound good but no idea how start, I never hear something like that.
4
AutoLISP (Vanilla / Visual) / Copy Layerfilters
« Last post by mailmaverick on Today at 03:18:37 AM »
How to Copy Layerfilters from one AutoCAD file to another (please see attached image) ?
5
AutoLISP (Vanilla / Visual) / Loading custom menus
« Last post by like_citrus on Today at 02:30:57 AM »
I have 3 custom menus which I'm trying to load into AutoCAD.

The script below was taken from a textbook and it was for AutoCAD 2000 (type SCRIPT to load file). It still sort of worked when I had 2 custom menus but the response from AutoCAD was inconsistent. Sometimes you could call up each script file and then both menus would load. Sometimes you'd load one, then the next one wouldn't load. Sometimes both would disappear from view. After a few trials, you'd eventually see 2 menu files.

I can't load 3 menu files though.
Having tried MENULOAD, each menu does load but I have an issue with the menu actions. The action is that a structural section is inserted. But with MENULOAD, it doesn't work.
Is there a way to resolve?
 
"BlockInsert" is set to is a LISP routine set to autoload.
To test, place in C drive in folder "POP103 Structural Steel".

SCRIPT
Code: [Select]
(if (and (not (findfile "STRUCTURAL_STEEL.mnu"))
(findfile "C:\\POP103 Structural Steel\\STRUCTURAL_STEEL.mnu")
)
(setenv "ACAD" (strcat (getenv "ACAD") "C:\\POP103 Structural Steel"))
)
(command "._MENULOAD" "STRUCTURAL_STEEL.mnu")
(menucmd "P103=+STRUCTURAL_STEEL.CTOPopSTRUCTURAL_STEEL")

MENU FILE
Code: [Select]
***MENUGROUP=STRUCTURAL_STEEL
***POP103
**CTOPopSTRUCTURAL_STEEL

[Structural Steel]

[->UB]
   [530UB82]^C^C(BlockInsert "UniversalBeams_530UB82.0");scale;1;
   [<-530UB92]^C^C(BlockInsert "UniversalBeams_530UB92.4");scale;1;

"BlockInsert"
Code: [Select]
(defun BlockInsert (blkname)
    (command "_.-insert" (substr (strcat blkname "-" (menucmd "m=$(edtime,0,yymoddhhmmss)") "=" blkname) (+ (vl-string-position (ascii "_") blkname 1) 2)) pause 1 "" 0)
)
6
AutoLISP (Vanilla / Visual) / Re: Setting Color for 2nd Character in Mtext
« Last post by BIGAL on January 27, 2021, 11:41:23 PM »
You may need to entmake the mtext as a dummy text "a" then use vl-put-textstring with the correct coding of the top of my head "a{\\C1b}cdef"

The "b" will be red.
7
AutoLISP (Vanilla / Visual) / Re: Setting Color for 2nd Character in Mtext
« Last post by d2010 on January 27, 2021, 11:31:25 PM »
Sărbătoarea Aducerii moaștelor Sfântului Ierarh Ioan Gură de Aur
8
AutoLISP (Vanilla / Visual) / Re: BigAL ah:butts ?
« Last post by BIGAL on January 27, 2021, 11:03:22 PM »
Linetype change (setvar 'celtype ans)

One of the things I did recently was to make a dcl with radio buttons and  toggles. But I hard coded it, it is on my list to make a two column multi radio buttons.

The colordlg lists all colours thats 256 or do you want only a few ? You can have like about 20+ appear on screen its a screen limitation. Pretty sure tested a version with A-Z.

I am hoping to do the 2 columns soon. Really it could do more than 2 columns (list (list1)(list2)(list3)) would mean 3 columns. (list (list1)) means 1 column.
Have to have a think about returning button pressed.

If you provide 2 lists will try to put something together to test that suits you.

I updated the multi radio by adding a line padding version (setq ans (ah:butts but "v" 2 '("Choose LineType" "ByBlock" "Bylayer" when small number the buttons would crowd so the "2" implies 2 blank lines between buttons.
9
AutoLISP (Vanilla / Visual) / Setting Color for 2nd Character in Mtext
« Last post by MeasureUp on January 27, 2021, 07:45:34 PM »
As the title mentioned I want to set color (other than the default) for the 2nd character in mtext that I am creating.
I don't find anything that can do the setting for individual character from the group codes of entmake for mtext.
Your helps are much appreciated.
10
AutoLISP (Vanilla / Visual) / Re: BigAL ah:butts ?
« Last post by d2010 on January 27, 2021, 04:17:23 PM »
Do you need develop-Dynamically;DCL as Shadow of insideList?
Startup , you enter Q2[enter]
Pages: [1] 2 3 ... 10