$TEXTSIZE buradan yuksekligi istedigim yukseklik ile degistirdim . duzeldi .
Alıntıbaha07 :
merhabalar
elimde iki text arasindaki farki cikarip aradaki farki istedigim yere ekranda text olarak yazdiran bir lisp var . isimi goruyor .
sormak istedigim bu farki yeni text olarak yazdirirken ,bazi calistigim projelerde text yuksekligini farkli yapiyor .
bu fark hangi ayardan kaynaklaniyor buladim . hangi ayar oldugu konusunda bana yardimci olabilecek var mi ?
ornek dosyalari ekledim
Herkese Merhaba,
Aşağıda iki adet lisp paylaşacağım.
Birinci orjinal olan ikincisi ise benim yapmaya çalıştığım
Birinci lisp "M" yazan yazıları algılayıp toplamını alıyor.
ikinci lisp'de "M" yazısından farklı string değeri için kullanıcıdan input istetip yeni string değerine göre toplatmak.
nerede hata yapıyorum yardımcı olursanız sevinirim.
Erkan hocam teşekkür ederim yardımınız için. Son bir konu hakkında tecrübenize ihtiyacım var.
Excel ile AutoCAD arasında ilişki kurmak ile ilgili çok kaynak var sitede. Fakat benim ihtiyacıma karşılık vermiyor ya da ben bulamadım.
Elimde excel .xlsx uzantılı bir dosya var ve içeriğin nasıl göründüğünü aşağıda gösterdim.
Excelde sadece aktif olan sayfa1 kullanılacak
AutoCAD'deki text'ler seçilecek,
Excel seçilecek,
AutoCAD'de seçilen textlerin içeriği excel'de A sütununda aratılıp varsa, B sütununda yazan değer ile değiştirilecek.
Sonuç
belli bir yere kadar getiriyorum.
Kod:
(if (setq n 0 r 0 ss (ssget (list (cons 0 "TEXT,MTEXT"))))
(if (setq fl (getfiled "\nEXCEL DOSTAYISIN SECINIZ..." "" "xlsx;xls;csv;*" 16))
(progn
(setq fl (open fl "r"))
(command "_.undo" "be")
(repeat (sslength ss)
(setq en (entget (ssname ss n)))
.................
.................
(close fl)
)
)
) (princ)
)
bir lisp isteğim var , aslında bunu qselect üzerinden halledebiliyorum ama işlerimi daha hızlı yapmak istediğim için sizden destek bekliyorum .
lispin mantığı şudur;
1 adet pline seçtirecek , bu seçilen plinenin ELEVATİON değerini alıp projedeki aynı ELEVATİON da olan PLİNElerini seçecek bir lispe ihtiyacım var . aslında mantığı biraz qselect+selecsimiler gibi olmuş olacak şimdiden teşekkür ederim.
Alıntıalisezgin :
merhaba şeflerim ,
bir lisp isteğim var , aslında bunu qselect üzerinden halledebiliyorum ama işlerimi daha hızlı yapmak istediğim için sizden destek bekliyorum .
lispin mantığı şudur;
1 adet pline seçtirecek , bu seçilen plinenin ELEVATİON değerini alıp projedeki aynı ELEVATİON da olan PLİNElerini seçecek bir lispe ihtiyacım var . aslında mantığı biraz qselect+selecsimiler gibi olmuş olacak şimdiden teşekkür ederim.
merhaba
belki isini gorur
Kod:
;; secilen plinin z degerine gore tum plinlari secer renk - cizgi tipi - tabaka ayrimi yapmaz
;; https://www.cadtutor.net/forum/topic/77277-select-polylines-with-the-same-thickness/#findComment-616094
;; turetilmistir
;; 1/ having the same elev, never mind the color or linetype
(defun c:PZSEC ( / source elev ss i pickset)
;; user selects source
(setq source (car (entsel "\nSelect Source object: ")))
;; read line elev
(setq elev (cdr (assoc 38 (entget source)))) ;; line elev
;; select all ploylines with that thinkness
(setq ss (ssget "_X" (list (cons 0 "*POLYLINE") (cons '38 elev))))
;; now grip these objects
(setq pickset (ssadd))
(setq i 0)
(repeat (sslength ss)
(ssadd (ssname ss i) pickset)
(setq i (+ i 1))
)
;; this grips the objects
(sssetfirst nil pickset)
)
Alıntıalisezgin :
merhaba şeflerim ,
bir lisp isteğim var , aslında bunu qselect üzerinden halledebiliyorum ama işlerimi daha hızlı yapmak istediğim için sizden destek bekliyorum .
lispin mantığı şudur;
1 adet pline seçtirecek , bu seçilen plinenin ELEVATİON değerini alıp projedeki aynı ELEVATİON da olan PLİNElerini seçecek bir lispe ihtiyacım var . aslında mantığı biraz qselect+selecsimiler gibi olmuş olacak şimdiden teşekkür ederim.
merhaba
belki isini gorur
Kod:
;; secilen plinin z degerine gore tum plinlari secer renk - cizgi tipi - tabaka ayrimi yapmaz
;; https://www.cadtutor.net/forum/topic/77277-select-polylines-with-the-same-thickness/#findComment-616094
;; turetilmistir
;; 1/ having the same elev, never mind the color or linetype
(defun c:PZSEC ( / source elev ss i pickset)
;; user selects source
(setq source (car (entsel "\nSelect Source object: ")))
;; read line elev
(setq elev (cdr (assoc 38 (entget source)))) ;; line elev
;; select all ploylines with that thinkness
(setq ss (ssget "_X" (list (cons 0 "*POLYLINE") (cons '38 elev))))
;; now grip these objects
(setq pickset (ssadd))
(setq i 0)
(repeat (sslength ss)
(ssadd (ssname ss i) pickset)
(setq i (+ i 1))
)
;; this grips the objects
(sssetfirst nil pickset)
)
teşekkürler tam istediğim gibi olmuş , elinize sağlık
Şeflerim tekrar merhaba ve yeni bir lisp isteğim daha olacak , müsaitseniz uğraşırsanız sevinirim.
Çalışma mantığı ; mevcutta olan bir PLİNE var , bu plineyı merkezleyerek 10 birim arkalı önlü açacak ve bitiş noktalarını birbirine birleştirerek RECTANG gibi bir şey elde etmiş olacağım. ilgi ve alakanız için şimdiden teşekkürler
Alıntıalisezgin :
Şeflerim tekrar merhaba ve yeni bir lisp isteğim daha olacak , müsaitseniz uğraşırsanız sevinirim.
Çalışma mantığı ; mevcutta olan bir PLİNE var , bu plineyı merkezleyerek 10 birim arkalı önlü açacak ve bitiş noktalarını birbirine birleştirerek RECTANG gibi bir şey elde etmiş olacağım. ilgi ve alakanız için şimdiden teşekkürler
selamlar , bu isini gormesi gerekiyor
Kod:
; Polyline,line,ARC,Spline ucu acik cizgilerin sagina soluna istenen degerde offset atar ve uclarini birlestirerek kapali alan olusturur
; orjinal cizginin silinmesini istiyorsaniz "" ;(entdel ent); eliminate original "" satirinin onundeki "" ; "" kaldirin
; Kent Cooper tarafindan yazildi
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-both-sides-and-close/td-p/9425701/page/4
;| OffsetBothSidesClose.lsp [command name: OBSC]
To Offset the same open-ended object(s) to Both Sides at the same distance,
close the ends, and join into single closed object [Polyline(s) or Spline(s)].
On first use, offers regular Offset command's default distance, but only if
numerical [not "Through"].
Remembers specified offset distance, separately from regular
Offset command's default, and offers as default on later use.
Works on any object(s) with linearity [of (vlax-curve) classes], other than 3D
Polylines [can't be Offset], and Circles, full Ellipses and closed Splines and
Polylines [no ends to close], in any Coordinate System. Allows selection
of all those other than Circles, to allow selection of qualifying objects of
same entity types, but does not process them.
Kent Cooper, 14 April 2020 [based on and expanded from modified elements
from OffsetBothSides.lsp and PLWtoOutline.lsp]. Last edited 6 June 2024.
|;
(defun C:OBSC (/ *error* doc svn svv osd ss n obj); = Offset to Both Sides & Close
(defun *error* (errmsg)
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg))
); if
(if ucschanged (command-s "_.ucs" "_previous"))
(mapcar 'setvar svn svv); reset System Variables
(vla-endundomark doc)
(princ)
); defun - *error*
;
(vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
(setq
svn '(osmode cmdecho blipmode peditaccept offsetdist)
svv (mapcar 'getvar svn)
); setq
;
(initget (if (or *obscdist (> osd 0)) 6 7))
; no 0, no negative, no Enter on first use if OffsetDist = Through
(setq
osd (last svv); Offset's default distance
*obscdist ; global variable
(cond
( (getdist
(strcat
"\nBoth-sides-offset distance"
(strcat
(if (or *obscdist (> osd 0))
(strcat ; then - construct default
" <"
(if *obscdist
(rtos *obscdist)
(rtos osd)
); if
">"
); strcat
"" ; else - no default offered on first use if Offset's is Through
); if
); strcat
": "
); strcat
); getdist
); User-input condition
(*obscdist); Enter with prior value set - use that
((> osd 0) osd)
; Enter on first use with non-Through Offset default - use that
); cond & *obscdist
); setq
;
(prompt "\nTo Offset to Both Sides and Close ends,")
(if (setq ss (ssget "_:L" '((0 . "LINE,ARC,*POLYLINE,SPLINE,ELLIPSE"))))
; allows closed Polylines/Splines/Ellipses, & 3DPolylines, all bypassed below
(progn
(mapcar 'setvar svn '(0 0 0 1)); turn off Osnap, command echo, blips, on PEDITACCEPT
(repeat (setq n (sslength ss)); then
(setq ent (ssname ss (setq n (1- n))))
(if
(and
(not (vlax-curve-isClosed ent)); open-ended [for all but Line/Arc]
(not (member '(100 . "AcDb3dPolyline") (entget ent)))
); and
(progn ; then
(command "_.ucs" "_new" "_object" ent) ; set UCS to match object
(setq
ucschanged T ; for use in *error* function if UCS does not get reset
obj (vlax-ename->vla-object ent); needed for (vla-offset)
toJoin (ssadd); initially empty set of items to Join together
); setq
(vla-offset obj *obscdist); to one side
(ssadd (entlast) toJoin)
(vla-offset obj (- *obscdist)); to other side
(ssadd (entlast) toJoin)
(command "_.line" ; connect starts
"_none" (trans (vlax-curve-getStartPoint (ssname toJoin 0)) 0 1)
"_none" (trans (vlax-curve-getStartPoint (ssname toJoin 1)) 0 1)
""
); command
(ssadd (entlast) toJoin)
(command "_.line" ; connect ends
"_none" (trans (vlax-curve-getEndPoint (ssname toJoin 0)) 0 1)
"_none" (trans (vlax-curve-getEndPoint (ssname toJoin 1)) 0 1)
""
); command
(ssadd (entlast) toJoin)
(if (wcmatch (cdr (assoc 0 (entget ent))) "LINE,ARC")
(command "_.pedit" "_multiple" toJoin "" "_join" 0 ""); then
(command "_.join" (ssname toJoin 1) toJoin ""); else
); if
(command "_.ucs" "_prev"); reset UCS
(setq ucschanged nil); eliminate reset in *error* function
;(entdel ent); eliminate original
); progn
); if [open-ended]
); repeat
(mapcar 'setvar svn svv); reset System Variables
); progn
); if [selection]
(vla-endundomark doc)
;
(princ)
); defun
(vl-load-com)
(prompt "Type OBSC to Offset to Both Sides by the same distance, and Close ends.")
Mümkünse benim bir lisp isteğim var.. Forumun acemisi olduğum için özel mesaj atmayı beceremedim. Çizgi layerlerini kendi layerı bazında birleşim yerlerinden bölecek ve ayıracak.. Diğer çizgilerden bölmemesi gerekli.. Tabi layeri select similar ile önceden seçmeliyim. Veya lisp bunu kendi yapabilirse de güzel olur. Forumu karıştırdım ama böyle bir lisp var mı göremedim. Eğer meşakkatli bir kod ise karşılığını da uygun şartlarda sağlayabilirim. Şimdiden çok teşekkür ediyorum.
Diğer arkadaşlardan da yardımcı olabilecek varsa memnun olurum..
Alıntıalisezgin :
Şeflerim tekrar merhaba ve yeni bir lisp isteğim daha olacak , müsaitseniz uğraşırsanız sevinirim.
Çalışma mantığı ; mevcutta olan bir PLİNE var , bu plineyı merkezleyerek 10 birim arkalı önlü açacak ve bitiş noktalarını birbirine birleştirerek RECTANG gibi bir şey elde etmiş olacağım. ilgi ve alakanız için şimdiden teşekkürler
selamlar , bu isini gormesi gerekiyor
Kod:
; Polyline,line,ARC,Spline ucu acik cizgilerin sagina soluna istenen degerde offset atar ve uclarini birlestirerek kapali alan olusturur
; orjinal cizginin silinmesini istiyorsaniz "" ;(entdel ent); eliminate original "" satirinin onundeki "" ; "" kaldirin
; Kent Cooper tarafindan yazildi
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-both-sides-and-close/td-p/9425701/page/4
;| OffsetBothSidesClose.lsp [command name: OBSC]
To Offset the same open-ended object(s) to Both Sides at the same distance,
close the ends, and join into single closed object [Polyline(s) or Spline(s)].
On first use, offers regular Offset command's default distance, but only if
numerical [not "Through"].
Remembers specified offset distance, separately from regular
Offset command's default, and offers as default on later use.
Works on any object(s) with linearity [of (vlax-curve) classes], other than 3D
Polylines [can't be Offset], and Circles, full Ellipses and closed Splines and
Polylines [no ends to close], in any Coordinate System. Allows selection
of all those other than Circles, to allow selection of qualifying objects of
same entity types, but does not process them.
Kent Cooper, 14 April 2020 [based on and expanded from modified elements
from OffsetBothSides.lsp and PLWtoOutline.lsp]. Last edited 6 June 2024.
|;
(defun C:OBSC (/ *error* doc svn svv osd ss n obj); = Offset to Both Sides & Close
(defun *error* (errmsg)
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg))
); if
(if ucschanged (command-s "_.ucs" "_previous"))
(mapcar 'setvar svn svv); reset System Variables
(vla-endundomark doc)
(princ)
); defun - *error*
;
(vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
(setq
svn '(osmode cmdecho blipmode peditaccept offsetdist)
svv (mapcar 'getvar svn)
); setq
;
(initget (if (or *obscdist (> osd 0)) 6 7))
; no 0, no negative, no Enter on first use if OffsetDist = Through
(setq
osd (last svv); Offset's default distance
*obscdist ; global variable
(cond
( (getdist
(strcat
"\nBoth-sides-offset distance"
(strcat
(if (or *obscdist (> osd 0))
(strcat ; then - construct default
" <"
(if *obscdist
(rtos *obscdist)
(rtos osd)
); if
">"
); strcat
"" ; else - no default offered on first use if Offset's is Through
); if
); strcat
": "
); strcat
); getdist
); User-input condition
(*obscdist); Enter with prior value set - use that
((> osd 0) osd)
; Enter on first use with non-Through Offset default - use that
); cond & *obscdist
); setq
;
(prompt "\nTo Offset to Both Sides and Close ends,")
(if (setq ss (ssget "_:L" '((0 . "LINE,ARC,*POLYLINE,SPLINE,ELLIPSE"))))
; allows closed Polylines/Splines/Ellipses, & 3DPolylines, all bypassed below
(progn
(mapcar 'setvar svn '(0 0 0 1)); turn off Osnap, command echo, blips, on PEDITACCEPT
(repeat (setq n (sslength ss)); then
(setq ent (ssname ss (setq n (1- n))))
(if
(and
(not (vlax-curve-isClosed ent)); open-ended [for all but Line/Arc]
(not (member '(100 . "AcDb3dPolyline") (entget ent)))
); and
(progn ; then
(command "_.ucs" "_new" "_object" ent) ; set UCS to match object
(setq
ucschanged T ; for use in *error* function if UCS does not get reset
obj (vlax-ename->vla-object ent); needed for (vla-offset)
toJoin (ssadd); initially empty set of items to Join together
); setq
(vla-offset obj *obscdist); to one side
(ssadd (entlast) toJoin)
(vla-offset obj (- *obscdist)); to other side
(ssadd (entlast) toJoin)
(command "_.line" ; connect starts
"_none" (trans (vlax-curve-getStartPoint (ssname toJoin 0)) 0 1)
"_none" (trans (vlax-curve-getStartPoint (ssname toJoin 1)) 0 1)
""
); command
(ssadd (entlast) toJoin)
(command "_.line" ; connect ends
"_none" (trans (vlax-curve-getEndPoint (ssname toJoin 0)) 0 1)
"_none" (trans (vlax-curve-getEndPoint (ssname toJoin 1)) 0 1)
""
); command
(ssadd (entlast) toJoin)
(if (wcmatch (cdr (assoc 0 (entget ent))) "LINE,ARC")
(command "_.pedit" "_multiple" toJoin "" "_join" 0 ""); then
(command "_.join" (ssname toJoin 1) toJoin ""); else
); if
(command "_.ucs" "_prev"); reset UCS
(setq ucschanged nil); eliminate reset in *error* function
;(entdel ent); eliminate original
); progn
); if [open-ended]
); repeat
(mapcar 'setvar svn svv); reset System Variables
); progn
); if [selection]
(vla-endundomark doc)
;
(princ)
); defun
(vl-load-com)
(prompt "Type OBSC to Offset to Both Sides by the same distance, and Close ends.")
Alıntıalisezgin :
Şeflerim tekrar merhaba ve yeni bir lisp isteğim daha olacak , müsaitseniz uğraşırsanız sevinirim.
Çalışma mantığı ; mevcutta olan bir PLİNE var , bu plineyı merkezleyerek 10 birim arkalı önlü açacak ve bitiş noktalarını birbirine birleştirerek RECTANG gibi bir şey elde etmiş olacağım. ilgi ve alakanız için şimdiden teşekkürler
selamlar , bu isini gormesi gerekiyor
Kod:
; Polyline,line,ARC,Spline ucu acik cizgilerin sagina soluna istenen degerde offset atar ve uclarini birlestirerek kapali alan olusturur
; orjinal cizginin silinmesini istiyorsaniz "" ;(entdel ent); eliminate original "" satirinin onundeki "" ; "" kaldirin
; Kent Cooper tarafindan yazildi
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-both-sides-and-close/td-p/9425701/page/4
;| OffsetBothSidesClose.lsp [command name: OBSC]
To Offset the same open-ended object(s) to Both Sides at the same distance,
close the ends, and join into single closed object [Polyline(s) or Spline(s)].
On first use, offers regular Offset command's default distance, but only if
numerical [not "Through"].
Remembers specified offset distance, separately from regular
Offset command's default, and offers as default on later use.
Works on any object(s) with linearity [of (vlax-curve) classes], other than 3D
Polylines [can't be Offset], and Circles, full Ellipses and closed Splines and
Polylines [no ends to close], in any Coordinate System. Allows selection
of all those other than Circles, to allow selection of qualifying objects of
same entity types, but does not process them.
Kent Cooper, 14 April 2020 [based on and expanded from modified elements
from OffsetBothSides.lsp and PLWtoOutline.lsp]. Last edited 6 June 2024.
|;
(defun C:OBSC (/ *error* doc svn svv osd ss n obj); = Offset to Both Sides & Close
(defun *error* (errmsg)
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg))
); if
(if ucschanged (command-s "_.ucs" "_previous"))
(mapcar 'setvar svn svv); reset System Variables
(vla-endundomark doc)
(princ)
); defun - *error*
;
(vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
(setq
svn '(osmode cmdecho blipmode peditaccept offsetdist)
svv (mapcar 'getvar svn)
); setq
;
(initget (if (or *obscdist (> osd 0)) 6 7))
; no 0, no negative, no Enter on first use if OffsetDist = Through
(setq
osd (last svv); Offset's default distance
*obscdist ; global variable
(cond
( (getdist
(strcat
"\nBoth-sides-offset distance"
(strcat
(if (or *obscdist (> osd 0))
(strcat ; then - construct default
" <"
(if *obscdist
(rtos *obscdist)
(rtos osd)
); if
">"
); strcat
"" ; else - no default offered on first use if Offset's is Through
); if
); strcat
": "
); strcat
); getdist
); User-input condition
(*obscdist); Enter with prior value set - use that
((> osd 0) osd)
; Enter on first use with non-Through Offset default - use that
); cond & *obscdist
); setq
;
(prompt "\nTo Offset to Both Sides and Close ends,")
(if (setq ss (ssget "_:L" '((0 . "LINE,ARC,*POLYLINE,SPLINE,ELLIPSE"))))
; allows closed Polylines/Splines/Ellipses, & 3DPolylines, all bypassed below
(progn
(mapcar 'setvar svn '(0 0 0 1)); turn off Osnap, command echo, blips, on PEDITACCEPT
(repeat (setq n (sslength ss)); then
(setq ent (ssname ss (setq n (1- n))))
(if
(and
(not (vlax-curve-isClosed ent)); open-ended [for all but Line/Arc]
(not (member '(100 . "AcDb3dPolyline") (entget ent)))
); and
(progn ; then
(command "_.ucs" "_new" "_object" ent) ; set UCS to match object
(setq
ucschanged T ; for use in *error* function if UCS does not get reset
obj (vlax-ename->vla-object ent); needed for (vla-offset)
toJoin (ssadd); initially empty set of items to Join together
); setq
(vla-offset obj *obscdist); to one side
(ssadd (entlast) toJoin)
(vla-offset obj (- *obscdist)); to other side
(ssadd (entlast) toJoin)
(command "_.line" ; connect starts
"_none" (trans (vlax-curve-getStartPoint (ssname toJoin 0)) 0 1)
"_none" (trans (vlax-curve-getStartPoint (ssname toJoin 1)) 0 1)
""
); command
(ssadd (entlast) toJoin)
(command "_.line" ; connect ends
"_none" (trans (vlax-curve-getEndPoint (ssname toJoin 0)) 0 1)
"_none" (trans (vlax-curve-getEndPoint (ssname toJoin 1)) 0 1)
""
); command
(ssadd (entlast) toJoin)
(if (wcmatch (cdr (assoc 0 (entget ent))) "LINE,ARC")
(command "_.pedit" "_multiple" toJoin "" "_join" 0 ""); then
(command "_.join" (ssname toJoin 1) toJoin ""); else
); if
(command "_.ucs" "_prev"); reset UCS
(setq ucschanged nil); eliminate reset in *error* function
;(entdel ent); eliminate original
); progn
); if [open-ended]
); repeat
(mapcar 'setvar svn svv); reset System Variables
); progn
); if [selection]
(vla-endundomark doc)
;
(princ)
); defun
(vl-load-com)
(prompt "Type OBSC to Offset to Both Sides by the same distance, and Close ends.")