乐筑天下

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

栅格的裁剪边界

[复制链接]
243

1

主题

1

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2007-11-13 15:04:49 | 显示全部楼层 |阅读模式
我在这里有点困难,尽管我尽了一切努力
这是VBA示例,结合了我的一些代码
在ClipPoint部分,我有点弄清楚他们在做什么,但是在我插入我的光栅之后;我设置的剪辑边界不起作用。
我在0,0插入光栅
然后我想将光栅剪辑到5',5'Boundarie
有人能告诉我应该如何正确填写ClipPoint部分(点)才能得到它吗?
谢谢
Mark
  1. Sub InstRast()
  2.     Dim InsertPnt(0 To 2) As Double
  3.     Dim scalefactor As Double
  4.     Dim RotAngle As Double
  5.     Dim Imgpth As String
  6.     Dim Imgname As String
  7.     Dim RastImg As AcadRasterImage
  8.    
  9.     Imgpth = "K:\AutoCAD\Work Related"
  10.     Imgname = "FtWashington600.tif"
  11.    
  12.     InsertPnt(0) = 0#: InsertPnt(1) = 0#: InsertPnt(2) = 0#
  13.     scalefactor = 12#
  14.     rotationAngle = 0
  15.    
  16.     On Error Resume Next
  17.    
  18.     Set RastImg = ThisDrawing.PaperSpace.AddRaster(Imgpth & Imgname, InsertPnt, scalefactor, RotAngle)
  19.    
  20.     RastImg.Name = Imgname
  21.     RastImg.Name = Left(Imgname, Len(Imgname) - 4)
  22.    
  23.     If Err.Description = "Filer error" Then
  24.         MsgBox ImageName & " could not be found."
  25.         Exit Sub
  26.     End If
  27.    
  28.     ZoomAll
  29.         
  30.     ' Establish the clip boundary with an array of points
  31.     Dim clipPoints(0 To 9) As Double
  32.     clipPoints(0) = 6: clipPoints(1) = 6.75
  33.     clipPoints(2) = 7: clipPoints(3) = 6
  34.     clipPoints(4) = 6: clipPoints(5) = 5
  35.     clipPoints(6) = 5: clipPoints(7) = 6
  36.     clipPoints(8) = 6: clipPoints(9) = 6.75
  37.    
  38.     ' Clip the image
  39.     RastImg.ClipBoundary clipPoints
  40.    
  41.     ' Enable the display of the clip
  42.     RastImg.ClippingEnabled = True
  43.     ThisDrawing.Regen acActiveViewport
  44.       
  45. End Sub

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

0

主题

5

帖子

5

银币

初来乍到

Rank: 1

铜币
7
发表于 2007-11-13 15:30:10 | 显示全部楼层
5'sq.以图像为中心,从插入点开始,还是其他东西?
从插入点基本上是
  1. Sub InstRast()
  2.     Dim InsertPnt(0 To 2) As Double
  3.     Dim scalefactor As Double
  4.     Dim RotAngle As Double
  5.     Dim Imgpth As String
  6.     Dim Imgname As String
  7.     Dim RastImg As AcadRasterImage
  8.    
  9.     Imgpth = "K:\AutoCAD\Work Related"
  10.     Imgname = "FtWashington600.tif"
  11.    
  12.     InsertPnt(0) = 0#: InsertPnt(1) = 0#: InsertPnt(2) = 0#
  13.     scalefactor = 12#
  14.     rotationAngle = 0
  15.    
  16.     On Error Resume Next
  17.    
  18.     Set RastImg = ThisDrawing.PaperSpace.AddRaster(Imgpth & Imgname, InsertPnt, scalefactor, RotAngle)
  19.    
  20.     RastImg.Name = Imgname
  21.     RastImg.Name = Left(Imgname, Len(Imgname) - 4)
  22.    
  23.     If Err.Description = "Filer error" Then
  24.         MsgBox ImageName & " could not be found."
  25.         Exit Sub
  26.     End If
  27.    
  28.     ZoomAll
  29.         
  30.     ' Establish the clip boundary with an array of points
  31.     Dim clipPoints(0 To 9) As Double
  32.     clipPoints(0) = 0: clipPoints(1) = 0
  33.     clipPoints(2) = 0: clipPoints(3) = 60
  34.     clipPoints(4) = 60: clipPoints(5) = 60
  35.     clipPoints(6) = 60: clipPoints(7) = 0
  36.     clipPoints(8) = 0: clipPoints(9) = 0
  37.    
  38.     ' Clip the image
  39.     RastImg.ClipBoundary clipPoints
  40.    
  41.     ' Enable the display of the clip
  42.     RastImg.ClippingEnabled = True
  43.     ThisDrawing.Regen acActiveViewport
  44.       
  45. End Sub

回复

使用道具 举报

0

主题

2

帖子

3

银币

初来乍到

Rank: 1

铜币
3
发表于 2007-11-13 15:43:29 | 显示全部楼层

鲍勃;
插入的“是”很好。
我注意到你用英寸来处理,我只是把60改成了5,因为我们用的是英尺。
太棒了!谢谢
现在我知道它是如何工作的了!
它以矩形前进。方向从下到上,从左到右。
这就是他们获得10分的原因。2(点(x+y) x 4边= 8 +回0,0 = 10
  1. Dim clipPoints(0 To 9) As Double
  2.     clipPoints(0) = 0: clipPoints(1) = 0
  3.     clipPoints(2) = 0: clipPoints(3) = 5
  4.     clipPoints(4) = 5: clipPoints(5) = 5
  5.     clipPoints(6) = 5: clipPoints(7) = 0
  6.     clipPoints(8) = 0: clipPoints(9) = 0

谢谢您
马克
回复

使用道具 举报

0

主题

11

帖子

5

银币

初来乍到

Rank: 1

铜币
12
发表于 2007-11-13 15:50:25 | 显示全部楼层
我不确定你是什么味道,所以我用英寸。我想民事会足够聪明,能弄清楚英尺和英寸之间的区别,建筑师,可能不会。
我认为顺时针或反(反)顺时针都没关系,我认为它可以是不规则的形状。不过,这只是一个猜测,我还没有真正研究过它。你需要做的就是列出XY坐标来定义一个最后一点与第一点相同的形状。最简单的方法是考虑如何在不接触鼠标的情况下放一条线。
回复

使用道具 举报

0

主题

7

帖子

5

银币

初来乍到

Rank: 1

铜币
11
发表于 2007-11-13 15:52:12 | 显示全部楼层

是的,你可以做一个不规则
的形状试试VBA的例子,这很奇怪
Mark
  1. Sub Example_ClippingEnabled()
  2.     ' This example adds a raster image in model space.
  3.     ' It then clips the image based on a clip boundary,
  4.     ' and toggles the display of the clipping.
  5.    
  6.     Dim insertionPoint(0 To 2) As Double
  7.     Dim scalefactor As Double
  8.     Dim rotationAngle As Double
  9.     Dim imageName As String
  10.     Dim rasterObj As AcadRasterImage
  11.    
  12.     imageName = "C:\AutoCAD\sample\downtown.jpg"
  13.     insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
  14.     scalefactor = 2#
  15.     rotationAngle = 0
  16.    
  17.     On Error Resume Next
  18.     ' Creates a raster image in model space
  19.     Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)
  20.    
  21.     If Err.Description = "Filer error" Then
  22.         MsgBox imageName & " could not be found."
  23.         Exit Sub
  24.     End If
  25.    
  26.     ZoomAll
  27.     MsgBox "Clip the image?", , "ClipBoundary Example"
  28.    
  29.     ' Establish the clip boundary with an array of points
  30.     Dim clipPoints(0 To 9) As Double
  31.     clipPoints(0) = 6: clipPoints(1) = 6.75
  32.     clipPoints(2) = 7: clipPoints(3) = 6
  33.     clipPoints(4) = 6: clipPoints(5) = 5
  34.     clipPoints(6) = 5: clipPoints(7) = 6
  35.     clipPoints(8) = 6: clipPoints(9) = 6.75
  36.    
  37.     ' Clip the image
  38.     rasterObj.clipBoundary clipPoints
  39.    
  40.     ' Enable the display of the clip
  41.     rasterObj.ClippingEnabled = True
  42.      ThisDrawing.Regen acActiveViewport
  43.    MsgBox "Turn off the display of the clipped image.", , "ClippingEnabled Example"
  44.    
  45.     ' Disable the display of the clip
  46.     rasterObj.ClippingEnabled = False
  47.     ThisDrawing.Regen acActiveViewport
  48.     MsgBox "Display off.", , "ClippingEnabled Example"
  49.    
  50. End Sub

回复

使用道具 举报

0

主题

8

帖子

4

银币

初来乍到

Rank: 1

铜币
9
发表于 2007-11-13 15:55:16 | 显示全部楼层
没错。我说的时候并不是指不规则的形状。我是说不止四边的东西。
回复

使用道具 举报

0

主题

9

帖子

5

银币

初来乍到

Rank: 1

铜币
10
发表于 2007-11-13 16:25:50 | 显示全部楼层

哦,好点
证据 4 边是 10 点。
我想你可以做更多,但不确定
在ACAD中,如果你真的好奇,你可以尝试图像剪辑命令,看看它给你什么
马克
回复

使用道具 举报

0

主题

6

帖子

4

银币

初来乍到

Rank: 1

铜币
7
发表于 2007-11-13 20:54:28 | 显示全部楼层
实际上,4面是5分。
  1. 1--------2
  2. 5        |
  3. |        |
  4. |        |
  5. 4--------3

每个点由一个坐标定义。 每个坐标是两个纵坐标(数字),一个X纵坐标和一个Y纵坐标,因此0,1是第一个点,2,3是第二个点,4,5,第三个,6,7是第四个,8,9是第五个,它复制了第一个点,以便边界关闭。 这对你有意义吗?
回复

使用道具 举报

0

主题

9

帖子

5

银币

初来乍到

Rank: 1

铜币
10
发表于 2007-11-14 09:56:30 | 显示全部楼层

是的,当然有,你说得完全正确
它是5点10分。
谢谢鲍勃!
回复

使用道具 举报

0

主题

4

帖子

5

银币

初来乍到

Rank: 1

铜币
5
发表于 2007-11-14 14:51:03 | 显示全部楼层

鲍勃,
让我问你或其他任何人这个
我有这个代码
  1. Dim llpnt As Variant 'lower left point
  2. Dim urpnt As Variant 'upper right point
  3. With ThisDrawing.Utility
  4. llpnt = .GetPoint(, vbCrLf & "Select Lower Left Point: ")
  5. urpnt = .GetPoint(, vbCrLf & "Select Upper Right Point: ")
  6. End With

我需要以某种方式使光栅的左下点和右上(拾取)点=我用剪贴簿定义的5'x 5'边界
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-5 16:49 , Processed in 0.998155 second(s), 72 queries .

© 2020-2025 乐筑天下

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