Guest giscad84 发表于 2022-7-5 19:43:14

Crossing Line Selction & Break

Hay friends I am John. Now I am doing the Project in Cad. So Iam expect Some Codes (Lsp). Any body helps me for this?(Plz see my 2 helps)
 
1)Here i am SelectingLine_Selection.dwg the Red Color(In Attached Dwg) Line and Give Command means wherever that Red line intersect with another line its should be break(Line means here Line & Polyline and Breakline(Both)).Here I am selecting multi line means also That multi line intersection Should be break. This is my challenge in my project. I want break with only lines (Source)
 
2) What ever entities (Like Block, Circle, Line, and PolyLine) crossing with my Selected line its should be select...

David Bethel 发表于 2022-7-5 19:47:37

John,
 
Welcome to the forum,
 
The main focus of the forum is to help people learn to code for themselves.Have you tried yourself?
 
Problem 1)Learn about (inters) function and the BREAK command
 
Problem 2)Learn about (ssget) function
 
-David

Guest giscad84 发表于 2022-7-5 19:51:16

I am New for Cad.I have worked with Only ArcGIS.So only i am asking.If you are given this Code means i will try to learn from this codes....So plz help me for this 2 Options.....

David Bethel 发表于 2022-7-5 19:54:37

John
 
Your problems are for someone with at least an intermediate level of knowledge of AutoLSIP, not a novice.I'd suggest that you start with basic cad functions and commands, prior to trying to create a fairly involved customization routine.-David

BIGAL 发表于 2022-7-5 20:00:34

If you want to throw yourself in the deep end then heres a start it wont work but it is the method to do what you want just pick two points across a group and return the Inters pt and object at that point.
 

;;;   by Alan;;;   1 April 1992;;;   ;;;DESCRIPTION;;;AUTOMATICALLY DIMENSIONS (setq ppt1 (ENTSEL "\npick first point to dimension :")) (setq tpp1 (entget (car ppt1) ) )(setq npt1 (cadr ppt1))(setq pt5 (getpoint"\npick second point to dimension :")) (setq ss (ssget "F" (list npt1 pt5))) ; ss this is the list of crossing objects (while (setq en (ssname ss 0)) ; loop now through objects    (setq dimpt1 (cdr (assoc 10 (entget en))))          (setq dimpt2 (cdr (assoc 11 (entget en))))          (setq newpt2 (inters pt5 npt1 dimpt1 dimpt2 nil))          (if (/= newpt2 nil)    (progn         (IF (/= NEWPT2 OLDPT)      (progn      (setq sss (cons newpt2 sss))      (SETQ OLDPT NEWPT2)      )      ); CHECK TO SEE IF SAME AS PREV   )    ); Delete each measured entity from set(ssdel en ss)                   )                              
 
A couple of other gotcha's when you do the "F" fence across objects it returns the objects not how you see them but rather as they were drawn in the database so you must sort them from the 1st point towards the 2nd point.

Guest balajibth 发表于 2022-7-5 20:05:12

 
 
 
This Code for dim..i am asking for What ever entities am selecting that lineSelected line touched entyties (Like Block, Circle, Line, and PolyLine) need to selected should be select...

Guest balajibth 发表于 2022-7-5 20:07:57

Dear All Plz chk the Code for Advance Selection..See #1 my 2) point
 
****(defun c:AS (/) (c:SelectEverythingTouching))
(defun c:SelectEverythingTouching (/ *error* #SS #P1 #P2 #Temp #Add #Num)
(defun *error* (#Message)
    (and #Message
         (not (wcmatch (strcase #Message) "*BREAK*,*CANCEL*,*QUIT*"))
         (princ (strcat "\nError: " #Message))
    ) ;_ and
) ;_ defun
(vl-load-com)
(cond
    ((setq #SS (ssget))
   (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
   (setq #Add (ssadd))
   (vlax-for x (setq #SS (vla-get-activeselectionset *AcadDoc*))
       (vla-getboundingbox x '#P1 '#P2)
       (setq #P1 (vlax-safearray->list #P1)
             #P2 (vlax-safearray->list #P2)
       ) ;_ setq
       (and (setq #Temp (ssget "_C"
                               (trans (list (car #P1) (cadr #P2) 0.) 0 1)
                               (trans (list (car #P2) (cadr #P1) 0.) 0 1)
                        ) ;_ ssget
            ) ;_ setq
            (repeat (setq #Num (sslength #Temp))
            (if (vlax-invoke
                  x
                  'IntersectWith
                  (vlax-ename->vla-object (ssname #Temp (setq #Num (1- #Num))))
                  acExtendNone
                  ) ;_ vlax-invoke
                (ssadd (ssname #Temp #Num) #Add)
                T
            ) ;_ if
            ) ;_ repeat
            (ssadd (vlax-vla-object->ename x) #Add)
       ) ;_ and
   ) ;_ vlax-for
   (vla-delete #SS)
   (sssetfirst nil #Add)
    )
) ;_ cond
(princ)
) ;_ defun
****

Lt Dan's l 发表于 2022-7-5 20:12:16

something for you to run with...

(defun c:test(/ p1 p2 ss id ent) (setq p1 (getpoint "\nSpecify first point: ")p2 (getpoint p1 "\nSpecify second point: ")) (if (eq (setq ss (ssget "F" (list p1 p2) '((0 . "line")))) nil)(prompt "\nNo lines found!")(repeat (setq id (sslength ss))    (setq ent (entget (ssname ss (setq id (1- id)))))    (entmakex      (list (cons 0 "point") (cons 10 (inters p1 p2 (cdr (assoc 10 ent))(cdr (assoc 11 ent))))             )    )) ) (princ))

Cad64 发表于 2022-7-5 20:13:47

 
Didn't I ask you to put your code in quote tags?
Yes, I did. 5 times! I feel like I'm talking to a brick wall.
Please refer to the PM I sent you previously, AGAIN!!!
 
Where's the banging head smiley?

alanjt 发表于 2022-7-5 20:19:55

Actually, I'd like to know why he feels it acceptable to post code that is not his and in doing so, has completely stripped my information from the code?
Seriously? You post over at theSwamp, I shoot you a link and you just rip off my code?
Your link wanting help: http://www.theswamp.org/index.php?topic=1892.0
A link to my code: http://www.theswamp.org/index.php?topic=32430.0
 
I don't know who's the bigger idiot here; me for being nice enough to help you or you for thinking I was stupid enough not to realize you hacked out my name and copyright notices from my own code. The really annoying thing is, in my notice, I give you all editing and posting rights, with the only stipulation being that you leave all notices IN TACT!
 
Excessive abuse of forum, posting under two usernames (the other of which was banned), badgering within threads to just post some code and now, thievery. You're off to a great start in these forums.
 
Seriously though, please remove the code you posted.
页: [1] 2
查看完整版本: Crossing Line Selction & Break