newer 发表于 2021-1-7 18:03:24

Accessing hatches with LISP

问题:
I am working with an AutoLISP routine and I am running into a problem. The routine uses a hatch pattern to fill an object and then uses the individual line information that makes up the hatch to do some calculations on the object. Way back in R13, hatches were blocks and we could use LISP to get the start point and end point of each individual line that made up the hatch. Is there a way to get this information with LISP in AutoCAD 2007?

解答:
There is no LISP function in the AutoCAD 2007 family to get the start and end points of hatch lines. The alternative to exploding the hatch is to use ObjectARX.There function AcDbHatch::getHatchLinesData() can be used to obtain the start and endpoints of the hatch lines.

The attached zip file contains a buildable project which demonstrates this technique.The arx file defines the lisp function (hatchlines) and needs an ename as parameter. The function returns a list with the start and end points you are looking for.

Please have a look at the source code if you are interested on how to use AcDbHatch::getHatchLinesData().

附件是完整ARX工程



页: [1]
查看完整版本: Accessing hatches with LISP