乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 64|回复: 16

[编程交流] Crossing Line Selction & Break

[复制链接]

1

主题

3

帖子

2

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 19:43:14 | 显示全部楼层 |阅读模式
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...
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 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
回复

使用道具 举报

1

主题

3

帖子

2

银币

初来乍到

Rank: 1

铜币
5
发表于 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.....
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 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
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 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.
 
  1. ;;;   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.
回复

使用道具 举报

11

主题

46

帖子

35

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
55
发表于 2022-7-5 20:05:12 | 显示全部楼层
 
 
 
This Code for dim..i am asking for What ever entities am selecting that line  Selected line touched entyties (Like Block, Circle, Line, and PolyLine) need to selected should be select...
回复

使用道具 举报

11

主题

46

帖子

35

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
55
发表于 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
****
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
310
发表于 2022-7-5 20:12:16 | 显示全部楼层
something for you to run with...
  1. (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))
回复

使用道具 举报

8

主题

1647

帖子

1647

银币

初来乍到

Rank: 1

铜币
36
发表于 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?
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 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.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-6 15:00 , Processed in 0.716341 second(s), 73 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表