乐筑天下

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

[编程交流] intersect spline whith z-coord

[复制链接]

16

主题

40

帖子

24

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-6 14:54:48 | 显示全部楼层 |阅读模式
i'm looking for a lisp routine for intersect spline at  coordinate value
   example
1. select the splines
2. input value of coordinate   (x=200 or y=400 or z=1000)
result points in  drawing
Thank you
回复

使用道具 举报

16

主题

40

帖子

24

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-6 14:59:47 | 显示全部楼层
i must add that the spline is always perpendicular on
some axis (in this case its about ship frames and water lines).
Im not at home whith lisp programming but the way to do it can be
1.input value (like z=4000)
1.when select a string it  takes a position of the axis
2. draw a perpendicolar line on the axis whit value -100000 +100000
2. find a intersection point between line and spline
3. delete the line
4.draw the point
回复

使用道具 举报

10

主题

973

帖子

909

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 15:02:23 | 显示全部楼层
Unfortunately, I don’t know lisp.  I did set up a test VBA routine.  It only works with one orientation, however, with a target elevation along the Z axis.  
 
The routine works best from either a Front or Side view – and a point picked at the desired intersection plane.
 
*Correction: Only works with entities parallel to the Front view* not Side View
 
Limited error checking employed.
 
  1. Sub PointsAtElevation()Dim dblPt(2) As DoubleDim ent As AcadEntityDim entMirror As AcadEntityDim varMin As VariantDim varMax As VariantDim dblThird(2) As DoubleDim dblElevation As DoubleDim varElevPt As VariantDim varReturn As VariantDim intCount As IntegerDim i As IntegerDim entPt As AcadPointDim objSS As AcadSelectionSetWith ThisDrawing  On Error Resume Next  .SelectionSets.Item("SSTemp").Delete  On Error GoTo 0  Set objSS = .SelectionSets.Add("SSTemp")  objSS.SelectOnScreen  If objSS.Count < 1 Then Exit Sub  varElevPt = .Utility.GetPoint(, "Select target elevation: ")  If UBound(varElevPt)  2 Then Exit Sub  For Each ent In objSS     ent.GetBoundingBox varMin, varMax     varMin(2) = varElevPt(2)     varMax(2) = varElevPt(2)     dblThird(0) = varMin(0)     dblThird(1) = varMin(1) + 1#     dblThird(2) = varMin(2) + 1#     Set entMirror = ent.Mirror3D(varMin, varMax, dblThird)     varReturn = entMirror.IntersectWith(ent, acExtendNone)     intCount = ((UBound(varReturn) + 1) / 3) - 1     For i = 0 To intCount        dblPt(0) = varReturn(3 * i)        dblPt(1) = varReturn(3 * i + 1)        dblPt(2) = varReturn(3 * i + 2)        ThisDrawing.ModelSpace.AddPoint (dblPt)     Next     entMirror.Delete  NextEnd WithEnd Sub
回复

使用道具 举报

10

主题

973

帖子

909

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 15:04:59 | 显示全部楼层
I should point out that I'm assuming the Splines are all planar and in parallel planes.
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 15:08:52 | 显示全部楼层
I'd say that it could not be done with plain AutoLISP.  I guess my question would be how to deal with multiple intersections of the spline with the given plane.  I would think that a full ship frame intersects say the water line in 2 places.  -David
回复

使用道具 举报

10

主题

973

帖子

909

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 15:12:37 | 显示全部楼层
 
No doubt.
 

  Perhaps even more if the design is a tunnel hull, cat- or trimaran.
回复

使用道具 举报

16

主题

40

帖子

24

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-6 15:14:29 | 显示全部楼层
Fisrt thank you for the answer but my exsperience whith vba is very poor
and i am not good enough to use the code.
Second i wont to add that always we divide the body lines of the ship
in left side, right side(almost mirror of left side),fore part and aft part.
In this case there is no multiple intersections of the spline.
Can somebody make the whole vba or lisp routine ?
Greetings
回复

使用道具 举报

10

主题

973

帖子

909

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 15:19:53 | 显示全部楼层
Is it possible to post a sample file with the splines set up in a typical configuration?  I’m envisioning a oriented 3D layout but guess I don’t know that for certain.
 
In general, an example file is the best way to give full scope to the problem in question.  The “full scope” also seems to be the best way to generate interest and enthusiasm within in the resident code writing community.
回复

使用道具 举报

16

主题

40

帖子

24

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
80
发表于 2022-7-6 15:23:20 | 显示全部楼层
sorry that i don't do it before
naw i attach one sample file with the splines set up in a typical configuration.
I must draw a lot of waterlines and then a lot of frames
Frames is in always situated in yz plane
and waterlines in xy plane
testforma.dwg
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:24:17 | 显示全部楼层
This is probably way off, as I have only caught the end of this thread, but this should find the intersections between your spline and the Polylines.
 
  1. (defun c:SplInt (/ spEnt ss spObj ObjLst iArr ptLst) (if (and (setq spEnt (car (entsel "\nSelect Spline to Retrieve Intersections...")))      (= "SPLINE" (cdadr (entget spEnt)))      (setq ss (ssget "X" (list (cons 0 "LWPOLYLINE") (cons 8 "SHP")           (if (getvar "CTAB")(cons 410 (getvar "CTAB"))               (cons 67 (- 1 (getvar "TILEMODE"))))))))   (progn     (setq spObj (vlax-ename->vla-object spEnt)       ObjLst (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss))))     (foreach Obj ObjLst   (setq iArr (vlax-variant-value (vla-IntersectWith spObj Obj acExtendNone)))   (if (> (vlax-safearray-get-u-bound iArr 1) 0)       (setq ptLst (cons (vlax-safearray->list iArr) ptLst))))     (alert (vl-princ-to-string ptLst)))   (princ "\n No Spline Selected or No PLines Found ")) (princ))
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 21:11 , Processed in 0.410008 second(s), 72 queries .

© 2020-2025 乐筑天下

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