栅格的裁剪边界
我在这里有点困难,尽管我尽了一切努力这是VBA示例,结合了我的一些代码
在ClipPoint部分,我有点弄清楚他们在做什么,但是在我插入我的光栅之后;我设置的剪辑边界不起作用。
我在0,0插入光栅
然后我想将光栅剪辑到5',5'Boundarie
有人能告诉我应该如何正确填写ClipPoint部分(点)才能得到它吗?
谢谢
Mark
Sub InstRast()
Dim InsertPnt(0 To 2) As Double
Dim scalefactor As Double
Dim RotAngle As Double
Dim Imgpth As String
Dim Imgname As String
Dim RastImg As AcadRasterImage
Imgpth = "K:\AutoCAD\Work Related\"
Imgname = "FtWashington600.tif"
InsertPnt(0) = 0#: InsertPnt(1) = 0#: InsertPnt(2) = 0#
scalefactor = 12#
rotationAngle = 0
On Error Resume Next
Set RastImg = ThisDrawing.PaperSpace.AddRaster(Imgpth & Imgname, InsertPnt, scalefactor, RotAngle)
RastImg.Name = Imgname
RastImg.Name = Left(Imgname, Len(Imgname) - 4)
If Err.Description = "Filer error" Then
MsgBox ImageName & " could not be found."
Exit Sub
End If
ZoomAll
' Establish the clip boundary with an array of points
Dim clipPoints(0 To 9) As Double
clipPoints(0) = 6: clipPoints(1) = 6.75
clipPoints(2) = 7: clipPoints(3) = 6
clipPoints(4) = 6: clipPoints(5) = 5
clipPoints(6) = 5: clipPoints(7) = 6
clipPoints(8) = 6: clipPoints(9) = 6.75
' Clip the image
RastImg.ClipBoundary clipPoints
' Enable the display of the clip
RastImg.ClippingEnabled = True
ThisDrawing.Regen acActiveViewport
End Sub
**** Hidden Message ***** 5'sq.以图像为中心,从插入点开始,还是其他东西?
从插入点基本上是
Sub InstRast()
Dim InsertPnt(0 To 2) As Double
Dim scalefactor As Double
Dim RotAngle As Double
Dim Imgpth As String
Dim Imgname As String
Dim RastImg As AcadRasterImage
Imgpth = "K:\AutoCAD\Work Related\"
Imgname = "FtWashington600.tif"
InsertPnt(0) = 0#: InsertPnt(1) = 0#: InsertPnt(2) = 0#
scalefactor = 12#
rotationAngle = 0
On Error Resume Next
Set RastImg = ThisDrawing.PaperSpace.AddRaster(Imgpth & Imgname, InsertPnt, scalefactor, RotAngle)
RastImg.Name = Imgname
RastImg.Name = Left(Imgname, Len(Imgname) - 4)
If Err.Description = "Filer error" Then
MsgBox ImageName & " could not be found."
Exit Sub
End If
ZoomAll
' Establish the clip boundary with an array of points
Dim clipPoints(0 To 9) As Double
clipPoints(0) = 0: clipPoints(1) = 0
clipPoints(2) = 0: clipPoints(3) = 60
clipPoints(4) = 60: clipPoints(5) = 60
clipPoints(6) = 60: clipPoints(7) = 0
clipPoints(8) = 0: clipPoints(9) = 0
' Clip the image
RastImg.ClipBoundary clipPoints
' Enable the display of the clip
RastImg.ClippingEnabled = True
ThisDrawing.Regen acActiveViewport
End Sub
鲍勃;
插入的“是”很好。
我注意到你用英寸来处理,我只是把60改成了5,因为我们用的是英尺。
太棒了!谢谢
现在我知道它是如何工作的了!
它以矩形前进。方向从下到上,从左到右。
这就是他们获得10分的原因。2(点(x+y) x 4边= 8 +回0,0 = 10
Dim clipPoints(0 To 9) As Double
clipPoints(0) = 0: clipPoints(1) = 0
clipPoints(2) = 0: clipPoints(3) = 5
clipPoints(4) = 5: clipPoints(5) = 5
clipPoints(6) = 5: clipPoints(7) = 0
clipPoints(8) = 0: clipPoints(9) = 0
谢谢您
马克 我不确定你是什么味道,所以我用英寸。我想民事会足够聪明,能弄清楚英尺和英寸之间的区别,建筑师,可能不会。
我认为顺时针或反(反)顺时针都没关系,我认为它可以是不规则的形状。不过,这只是一个猜测,我还没有真正研究过它。你需要做的就是列出XY坐标来定义一个最后一点与第一点相同的形状。最简单的方法是考虑如何在不接触鼠标的情况下放一条线。
是的,你可以做一个不规则
的形状试试VBA的例子,这很奇怪
Mark
Sub Example_ClippingEnabled()
' This example adds a raster image in model space.
' It then clips the image based on a clip boundary,
' and toggles the display of the clipping.
Dim insertionPoint(0 To 2) As Double
Dim scalefactor As Double
Dim rotationAngle As Double
Dim imageName As String
Dim rasterObj As AcadRasterImage
imageName = "C:\AutoCAD\sample\downtown.jpg"
insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0#
scalefactor = 2#
rotationAngle = 0
On Error Resume Next
' Creates a raster image in model space
Set rasterObj = ThisDrawing.ModelSpace.AddRaster(imageName, insertionPoint, scalefactor, rotationAngle)
If Err.Description = "Filer error" Then
MsgBox imageName & " could not be found."
Exit Sub
End If
ZoomAll
MsgBox "Clip the image?", , "ClipBoundary Example"
' Establish the clip boundary with an array of points
Dim clipPoints(0 To 9) As Double
clipPoints(0) = 6: clipPoints(1) = 6.75
clipPoints(2) = 7: clipPoints(3) = 6
clipPoints(4) = 6: clipPoints(5) = 5
clipPoints(6) = 5: clipPoints(7) = 6
clipPoints(8) = 6: clipPoints(9) = 6.75
' Clip the image
rasterObj.clipBoundary clipPoints
' Enable the display of the clip
rasterObj.ClippingEnabled = True
ThisDrawing.Regen acActiveViewport
MsgBox "Turn off the display of the clipped image.", , "ClippingEnabled Example"
' Disable the display of the clip
rasterObj.ClippingEnabled = False
ThisDrawing.Regen acActiveViewport
MsgBox "Display off.", , "ClippingEnabled Example"
End Sub
没错。我说的时候并不是指不规则的形状。我是说不止四边的东西。
哦,好点
证据 4 边是 10 点。
我想你可以做更多,但不确定
在ACAD中,如果你真的好奇,你可以尝试图像剪辑命令,看看它给你什么
马克 实际上,4面是5分。
1--------2
5 |
| |
| |
4--------3
每个点由一个坐标定义。 每个坐标是两个纵坐标(数字),一个X纵坐标和一个Y纵坐标,因此0,1是第一个点,2,3是第二个点,4,5,第三个,6,7是第四个,8,9是第五个,它复制了第一个点,以便边界关闭。 这对你有意义吗?
是的,当然有,你说得完全正确
它是5点10分。
谢谢鲍勃!
鲍勃,
让我问你或其他任何人这个
我有这个代码
Dim llpnt As Variant 'lower left point
Dim urpnt As Variant 'upper right point
With ThisDrawing.Utility
llpnt = .GetPoint(, vbCrLf & "Select Lower Left Point: ")
urpnt = .GetPoint(, vbCrLf & "Select Upper Right Point: ")
End With
我需要以某种方式使光栅的左下点和右上(拾取)点=我用剪贴簿定义的5'x 5'边界
页:
[1]
2