Question

I am creating a gradient inside of a LWPolyLine with the code

(progn
    (setq hatch (vla-addHatch mspace 
                              acPreDefinedGradient
                              "LINEAR"
                              :vlax-true
                              acGradientObject)
    )
    (vlax-put hatch 'PatternAngle (/ pi 2))
    (vlax-invoke hatch 'AppendOuterLoop (list pline))
    (vla-evaluate hatch)
)

The problem occurs when trying to set the PatternAngle. I get the error:

Error: AutoCAD.Application: Not applicable

Without that line, it works fine. The gradient is just rotated by 90 degrees.

What am I doing wrong? I have a feeling it has something to do with the acPreDefinedGradient. Like I shouldn't be using a predefined gradient. Possibly using acUserDefinedGradient.

Was it helpful?

Solution

Seems like I was supposed to use GradientAngle, not PatternAngle.

(progn
    (setq hatch (vla-addHatch mspace 
                              acPreDefinedGradient
                              "LINEAR"
                              :vlax-true
                              acGradientObject)
    )
    (vlax-put hatch 'GradientAngle (/ pi 2))
    (vlax-invoke hatch 'AppendOuterLoop (list pline))
    (vla-evaluate hatch)
)

Sheesh, I wish there was proper documentation on these things.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top